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

WordPress Trac noreply at wordpress.org
Mon Oct 30 14:13:29 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 dmsnell):

 Let's see if we can't hash this out in realtime when you have a chance.
 I'm unable to reproduce so I must be doing something wrong. There's
 nothing I can think of that should cause this behavior. Here is my test
 case:

 {{{#!php
 <?php
 // from inside a WordPress directory
 require_once( __DIR__ . '/wp-load.php' );

 $p = new WP_HTML_Tag_Processor( '<a href="https://wordpress.org">' );
 $p->next_tag();

 echo $p->get_updated_html();
 // <a href="https://wordpress.org">

 $p->set_attribute( 'rel', ' noopener nofollow' );
 echo $p->get_updated_html();
 // <a rel=" noopener nofollow" href="https://wp.com">

 $p->set_attribute( 'rel', 'noopener nofollow' );
 echo $p->get_updated_html();
 // <a rel="noopener nofollow" href="https://wp.com">
 }}}

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


More information about the wp-trac mailing list