[wp-trac] [WordPress Trac] #59682: Bug fix for rel attributes in social-link.php

WordPress Trac noreply at wordpress.org
Mon Oct 30 14:26:13 UTC 2023


#59682: Bug fix for rel attributes in social-link.php
--------------------------+------------------------------
 Reporter:  niallhotfoot  |       Owner:  (none)
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  6.3.2
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:
--------------------------+------------------------------

Comment (by niallhotfoot):

 Here you go man, I've broken it down into a quick copy and paste for you
 to see if it's happening on your end!


 {{{
 $rel = '';
 $link = '<li><a href="" class=""></a></li>';
 $processor = new WP_HTML_Tag_Processor( $link );
 $processor->next_tag( 'a' );
 $processor->set_attribute( 'rel', esc_attr( $rel ) . ' noopener nofollow'
 );
 $processor->set_attribute( 'target', '_blank' );

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

 I'm able to run that in a wordpress view file and get the same results, so
 it should be easier for you ot replicate with that!

 My var_dump hasn't added in the rel attribute! And I bet your's will! Let
 me know how you get on!

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


More information about the wp-trac mailing list