Support

Account

Home Forums General Issues How do I remove adding amp; after &?

Solved

How do I remove adding amp; after &?

  • Hi all. Please help with advice. On the front of the site there is a field with the type “TextArea”, in which users insert their data, including links. If the link address contains the ” & ” symbol, then in the backend part of the site, “amp;” is added to this symbol, and it turns out “& amp;”.
    How do I fix this? Here is the form code that is located on the front part:

    <?php
    acf_form(array(
    'fields'	=> array('res'),
    'submit_value'	=> 'Send',
    'updated_message' => __("", 'acf'),
    ));?>
  • The form input is sanitized by wp_kses_normalize_entities( string $string ), see:
    https://developer.wordpress.org/reference/functions/wp_kses_normalize_entities/.

    You can deactivate it by using the kses option, see:
    https://www.advancedcustomfields.com/resources/acf_form/

    <?php
    acf_form(array(
    	'fields'          => array('res'),
    	'submit_value'    => 'Send',
    	'updated_message' => __("", 'acf'),
    	'kses'            => false,
    ));?>

    However, it is never a good idea to not sanitize user input. If you pass up on kses, you should sanitize it some other way that watches out for links and leaves them intact.

  • thank you very much!

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘How do I remove adding amp; after &?’ is closed to new replies.