[wp-trac] [WordPress Trac] #64567: HTML API: get_attribute_names_with_prefix() should agree with enqueued attribute updates.

WordPress Trac noreply at wordpress.org
Tue Feb 10 17:18:07 UTC 2026


#64567: HTML API: get_attribute_names_with_prefix() should agree with enqueued
attribute updates.
--------------------------------------+---------------------
 Reporter:  dmsnell                   |       Owner:  (none)
     Type:  defect (bug)              |      Status:  new
 Priority:  normal                    |   Milestone:  7.0
Component:  HTML API                  |     Version:  6.2
 Severity:  minor                     |  Resolution:
 Keywords:  good-first-bug has-patch  |     Focuses:
--------------------------------------+---------------------

Comment (by phpbits):

 Tested using this PR: https://github.com/WordPress/wordpress-
 develop/pull/10828


 {{{
 add_filter( 'render_block_core/quote', 'test_attribute_names_with_prefix',
 10, 2 );

 function test_attribute_names_with_prefix( string $block_content, array
 $block ): string {

         $p = new WP_HTML_Tag_Processor( '<div>' );
         $p->next_tag();
         $p->set_attribute( 'id', 'test' );
         echo '<pre>';
         print_r( $p->get_attribute_names_with_prefix( '' ) );
         echo '</pre>';

         $processor = new WP_HTML_Tag_Processor( $block_content );
         $processor->next_tag();
         $processor->set_attribute( 'id', 'test' );
         echo '<pre>';
         print_r( $processor->get_attribute_names_with_prefix( '' ) );
         echo '</pre>';

         die();

         return $processor->get_updated_html();
 }
 }}}


 The code above returns the correct attributes here:


 {{{
 Array
 (
     [0] => id
 )
 Array
 (
     [0] => class
     [1] => id
 )
 }}}

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


More information about the wp-trac mailing list