Custom Fields
Support General Text Area escape HTML comments

  • Creator
  • #16153
    Resolved Mr Jon Marks

    If I enter

    <!--comment fun -->

    into a text area the value gets changed to

    <!--comment fun --<

    (Ironically I can not should you in the ticket as you are doing the same thing here)

    Can some option like raw be added to textareas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
  • #16154
    Mr Jon Marks

    Comments are being escaped so <!-- goes to & lt;!-- when it should not

    Mr Jon Marks

    Upon investigation this maybe an issue with wp_pre_kses_less_than.

    An option to not call kses would still be nice though

    Anh Tran

    Hi Jon,

    Since version 5.1, we add sanitization for all inputs. For textarea field, we use the wp_kses_post for sanitization and it sanitizes the HTML comments as you see.

    If you want to keep that, you probably need to bypass the sanitization by setting 'sanitize_callback' => 'none' for the field. Or write your custom sanitize callback. Please see the documentation for details.

    Mr Jon Marks

    Kses escapes comments that have markup in them but not comments without markup. I made a new filter on this for now on pre_kses hook.


Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.