[wp-trac] [WordPress Trac] #45352: wp_targeted_link_rel filter can result in rel attribute with no value
WordPress Trac
noreply at wordpress.org
Wed Nov 14 15:08:50 UTC 2018
#45352: wp_targeted_link_rel filter can result in rel attribute with no value
--------------------------+-----------------------------
Reporter: spartank | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: 5.0
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
== The Problem
A function for filter ''wp_targeted_link_rel'' that returns an empty
string will result in a ''rel'' attribute without a value. It would be
better in that case to not insert the ''rel'' attribute.
== How To Reproduce
Create function attached to ''wp_targeted_link_rel'' that returns empty
string.
{{{#!php
function my_targeted_link_rel($rel_values) {
return '';
}
add_filter('wp_targeted_link_rel', 'my_targeted_link_rel');
}}}
Resulting link will contain rel=""
{{{#!html
<a href="https://www.google.com" target="_blank"
rel="">Link</a>
}}}
== Possible Solutions
Return original link from ''wp_targeted_link_rel_callback'' after applying
''wp_targeted_link_rel'' if ''$rel'' variable is empty.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45352>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list