-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stop adding rel=noreferrer to links that open in a new tab #26914
Comments
It's worth noting that WordPress core has removed The same change should probably be implemented in Gutenberg too. |
@wpjames The block editor adds the 'noreferrer noopener' values for any links, but it doesn't use the value from Potentially it could do, though it may cause issues with block validation, so it might not be as simple as hooking the editor into Probably a good first step would be removing |
Wouldn't that also invalidate blocks? Are you thinking that we pick a new value and stick to it rather than having it change based on a global setting? I think we'd still have to create migrations, but the rendered output would be consistent. Is there a way we can cope with block output changing based on a global setting like that? If someone changes the default thumbnail image size, for example, I could see that affecting block output. I realise this would break the concept of the |
I tested stopping adding
I encounter a linting error when trying to commit the changes, we will need to remove or exclude this linting check if we want to make this change:
|
@adamsilverstein Looks like we can use the I think an option would have to be added to the config here:
Yep, testing #26968 it looks like the file block needs a deprecation. The button and image block only use The file block hardcodes |
Hi @talldan, The reason behind this is if there is no migration to automatically change the old links from add_filter( 'the_content', static function($content) {
$replace = array(" noreferrer" => "" ,"noreferrer " => "");
$new_content = strtr($content, $replace);
return $new_content;
}, 99 ); To get rid of the |
@isaumya No update from me. I'm not assigned to this issue. |
Sorry. Hey, @adamsilverstein any update on this issue? |
Is there a solution to this, yet? Having "noreferrer" automatically being added to links that open in new tabs is problematic. |
Is there any update on this issue? It's making using WordPress blocks for affiliate marketing very problematic. Also, the code mentioned earlier no longer provides a workaround for the issue.
|
via ticket 54410 Hello, Thank you for your response. Code doesn't work. //Removes noreferrer from new or updated posts Aforementioned github reference does not address rel=”noopener” There needs to be a permanent solution, because anyone can add rel=”noreferrer noopener” if they'd like, not the other way around. This can be further elaborated via https://core.trac.wordpress.org/ticket/59333#ticket "This impacts the entire wordpress opensource, and should be addressed respectively, and enhanced with either WP plugin, and/or the next WP update." Everyone (without going into intricacies of everything) has links on their wordpress websites, this impacts everyone. |
Just a couple of things remaining for this which I noted in a comment on #26968 |
I am on WP version 5.5.3 and I have added the following code to my child theme functions.php.
However, Gutenberg is still adding noreferrer when I create a new link that opens in a new tab. Where is this coming from?
I don't think it's necessary to hard code rel attributes into the link module. Just let wp_targeted_link_rel add the necessary rel attributes when the post is saved/updated.
The text was updated successfully, but these errors were encountered: