[wp-trac] [WordPress Trac] #45352: wp_targeted_link_rel filter can result in rel attribute with no value
WordPress Trac
noreply at wordpress.org
Thu Nov 15 15:54:16 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: Future
| Release
Component: Formatting | Version: 5.0
Severity: normal | Resolution:
Keywords: needs-unit-tests good-first-bug | Focuses:
has-patch |
-------------------------------------------------+-------------------------
Comment (by spartank):
@mcmwebsol I'm new to contributing to core, so I may be wrong, but I feel
like it would be a little simpler to put the change in the
__wp_targeted_link_rel_callback__ function, right after the apply_filters
call.
{{{
#!php
function wp_targeted_link_rel_callback( $matches ) {
$link_html = $matches[1];
$rel_match = array();
/**
* Filters the rel values that are added to links with `target`
attribute.
*
* @since 5.0.0
*
* @param string The rel values.
* @param string $link_html The matched content of the link tag
including all HTML attributes.
*/
$rel = apply_filters( 'wp_targeted_link_rel', 'noopener
noreferrer', $link_html );
//New If Statement
//------------------------------
if ( ! $rel ) {
return $matches[0];
}
//------------------------------
//The rest of the function as is
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45352#comment:4>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list