Skip to content

Stop adding rel=noreferrer to links that open in a new tab #26914

@wpjames

Description

@wpjames

I am on WP version 5.5.3 and I have added the following code to my child theme functions.php.

function my_targeted_link_rel($rel_values) {
 	return 'noopener';
}
add_filter('wp_targeted_link_rel', 'my_targeted_link_rel',999);

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.

Metadata

Metadata

Labels

[Feature] ExtensibilityThe ability to extend blocks or the editing experience[Feature] Link EditingLink components (LinkControl, URLInput) and integrations (RichText link formatting)[Status] In ProgressTracking issues with work in progress[Type] EnhancementA suggestion for improvement.

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions