Opened 3 years ago
Closed 3 years ago
#54306 closed defect (bug) (reported-upstream)
Code discrepancy with link rel attribute noreferrer value in WP Core
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | |
Focuses: | javascript, coding-standards | Cc: |
Description
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.
Thanks for the report!
Because the code needs to be edited within Gutenberg, the GitHub issue GB26914 would be the best place to continue this discussion and help move it forward.