[wp-trac] [WordPress Trac] #62024: wp_kses_post incorrectly escapes "<" attributes values

WordPress Trac noreply at wordpress.org
Tue Sep 10 09:23:30 UTC 2024


#62024: wp_kses_post incorrectly escapes "<" attributes values
------------------------------+-----------------------------
 Reporter:  jernstjernst      |      Owner:  (none)
     Type:  defect (bug)      |     Status:  new
 Priority:  normal            |  Milestone:  Awaiting Review
Component:  Formatting        |    Version:  trunk
 Severity:  normal            |   Keywords:
  Focuses:  coding-standards  |
------------------------------+-----------------------------
 Hello,

 We are trying to use wp_kses everywhere we output as recommended. However,
 we encountered the following issue:

 **Example:**

 {{{#!php
 <?php
 echo wp_kses_post('<button data-glide-dir="<"><</button>")
 ?>
 }}}


 **Expected result:**

 {{{
 <button data-glide-dir="<"><</button>
 }}}


 **Actual result:**

 {{{
 <button data-glide-dir="<</button>
 }}}


 This breaks glide.js unless we use this workaround
 (https://github.com/glidejs/glide/issues/547)

 I think this should be allowed as per
 https://html.spec.whatwg.org/multipage/syntax.html#syntax-attributes

 Thanks and best regards

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/62024>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list