[wp-trac] [WordPress Trac] #47202: Gutenberg doesn't honor the wp_targeted_link_rel Filter
WordPress Trac
noreply at wordpress.org
Thu May 9 14:53:14 UTC 2019
#47202: Gutenberg doesn't honor the wp_targeted_link_rel Filter
--------------------------+-----------------------------
Reporter: fabeyg | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Editor | Version:
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
There is some inconsistent behaviour in how Gutenberg honors the
wp_targeted_link_rel Filter.
In my filter I outpout just "noopener" instead of "noreferrer noopener"
for the rel attribute Links that oben in a new tab/window:
{{{#!php
<?php
function filter_save_link_rel ( $rel, $link ) {
return 'noopener';
}
add_filter( 'wp_targeted_link_rel', 'filter_save_link_rel', 10, 2 );
}}}
When I write a new Link in a Gutenberg Paragraph Block the Editor
automatically adds the rel="noopener noreferrer" attribute to the link.
However, when I remove the rel attribute in the HTML Block Editing Mode,
the attribute is replaced with the correct value according to the filter.
Here is a screenshot of a fresh WordPress install displaying this
behaviour:
[[Image(https://drive.google.com/file/d/1SslbjYcyd2SaQA9-ltSsPMbNojB5XXLc)]]
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47202>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list