[wp-trac] [WordPress Trac] #54306: Code discrepancy with link rel attribute noreferrer value in WP Core

WordPress Trac noreply at wordpress.org
Fri Oct 22 09:01:20 UTC 2021


#54306: Code discrepancy with link rel attribute noreferrer value in WP Core
------------------------------------------+-----------------------------
 Reporter:  isaumya                       |      Owner:  (none)
     Type:  defect (bug)                  |     Status:  new
 Priority:  normal                        |  Milestone:  Awaiting Review
Component:  Editor                        |    Version:
 Severity:  normal                        |   Keywords:
  Focuses:  javascript, coding-standards  |
------------------------------------------+-----------------------------
 Hi,
 while doing routing work I was checking the latest WP Core code and found
 something wired when it comes to Link `rel` attribute and the default
 value added to the `rel` attribute by WordPress core.

 So, if you look at the `/wp-includes/formatting.php` file you will see
 that in function `wp_targeted_link_rel()` [line no. 3167] and
 `wp_targeted_link_rel_callback()` [line no. 3205] the `noreferrer`
 relationship has been removed from WP core to be automatically added.
 Which means according to this WP core now only add `noopener` by itself
 but NOT `noreffer`.

 But now if you look at the `/wp-includes/js/dist/block-editor.js`, `block-
 library.js`, `blocks.js` and so on you will see that the Gutenberg block
 editor is still adding the `noreferrer` by itself to all links open in new
 tab which since WP v5.6.0 WP has removed automatically adding the
 `noreffer` relationship.

 This is very confusing as the WP PHP code is saying one thing while the
 Gutenberg JS files are saying different thing.

 Personally, I think the `noreffer` attribute should not be added
 automatically as it causes problem with referrals, affiliates and so many
 more things. Can anyone please look into this and at least say what's
 going on here? As what I am seeing in `formatting.php` and in the JS files
 simply does not convey the same message.

 I do see this thread in GitHub:
 https://github.com/WordPress/gutenberg/issues/26914 but almost after an
 year this minor issue is still hasn't been fixed or been looked at.

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


More information about the wp-trac mailing list