Skip to content
Custom fields for WordPress that are quick to build and quick to load. Get Pro
Docs

Security

On the way out

1 minute to read Updated 1 week ago

  • Everything printed is escaped for where it goes. ugly_show() picks the right way for each type of field, so you cannot forget it.
  • ugly_get() is raw on purpose. It gives you the value to decide things with. You escape where it matters, with esc_html(), esc_url() or esc_attr().
  • The templates written from a group never carry text from a title, a label or a name as code.
  • A < in a text field stays a < in Block Bindings.

The rule that keeps a site safe

You do Safe?
ugly_show( 'name' ) Yes. Escaped for its type
echo esc_html( ugly_get( 'name' ) ) Yes
echo esc_url( ugly_get( 'link' )['url'] ) Yes
echo ugly_get( 'name' ); No, unless the field is rich text, which is ready HTML. For any other type, escape
Putting ugly_get() inside a <script> or a style="" without wp_json_encode() or esc_attr() No

Did this article answer your question?