Support

Account

Home Forums Bug Reports Export to PHP issue with HTML entities

Solving

Export to PHP issue with HTML entities

  • Just found a bug which you may or may not be aware of. When exporting field groups to PHP, certain field value inputs are not having their HTML entities encoded and causing problems with the HTML. For example, I had a tag using less than (<) and greater than (>) in the instructions part of the field, which worked perfectly fine when creating field groups within ACF. When I tried using the exported PHP by copying/pasting it broke the entire layout because the characters weren’t encoded in the copy/paste code and were being treated as part of the HTML markup.

    An example of the exported code causing problems:

    array (
        'key' => 'field_52a38e4b8be24',
        'label' => 'Custom CSS',
        'name' => 'custom_css',
        'type' => 'textarea',
        'instructions' => 'Do not insert <style> tags.',
        'default_value' => '',
        'placeholder' => '',
        'maxlength' => '',
        'formatting' => 'none',
    );

    The problem was solved by manually encoding the < and > symbols.

    I think that you should be able to fix this by double encoding the field values being displayed, which will display the code as it should be copied/pasted.

  • Hi @Len Bradley

    Thanks for the bug report. I’ll add this to the to-do and let you know what I find.

    Thanks
    E

  • Hi @Len Bradley

    I know this is a year on, but just letting you know I’ve added a new setting to the message field in ACF PRO to control if the message uses the esc_html function.

    This will allow you to control how the HTML is rendered and prevent the HTML tag from breaking the page!

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

The topic ‘Export to PHP issue with HTML entities’ is closed to new replies.