[wp-trac] [WordPress Trac] #59891: Incorrect example for WP_HTML_Tag_Processor class

WordPress Trac noreply at wordpress.org
Sat Nov 11 15:37:09 UTC 2023


#59891: Incorrect example for WP_HTML_Tag_Processor class
--------------------------+------------------------------
 Reporter:  atachibana    |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  HTML API      |     Version:  6.4
 Severity:  minor         |  Resolution:
 Keywords:                |     Focuses:  docs
--------------------------+------------------------------
Changes (by sabernhardt):

 * focuses:   => docs


Old description:

> This issue was originally reported as https://github.com/WordPress
> /Documentation-Issue-Tracker/issues/1362.
>
> The examples in the documentation reference:
> https://developer.wordpress.org/reference/classes/wp_html_tag_processor
> /#modifying-html-attributes-for-a-found-tag
> using the class parameter to query for an existing class on a tag. But
> the source code and code function documentation actually only suppor the
> class_name property:
> The example under Modifying HTML attributes for a found tag should be:
>
> {{{
> if ( $tags->next_tag( array( 'class_name' => 'wp-group-block' ) ) ) {
> }}}
>
> At least for me in WP 6.3.
>
> Reported by @gaambo via User Contributed Notes.

New description:

 This issue was originally reported as https://github.com/WordPress
 /Documentation-Issue-Tracker/issues/1362.

 The examples in the documentation reference:
 https://developer.wordpress.org/reference/classes/wp_html_tag_processor
 /#modifying-html-attributes-for-a-found-tag
 using the class parameter to query for an existing class on a tag. But the
 source code and code function documentation actually only support the
 `class_name` property:
 The example under Modifying HTML attributes for a found tag should be:

 {{{
 if ( $tags->next_tag( array( 'class_name' => 'wp-group-block' ) ) ) {
 }}}

 At least for me in WP 6.3.

 Reported by @gaambo via User Contributed Notes.

--

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/59891#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list