Make WordPress Core


Ignore:
Timestamp:
01/22/2019 09:54:26 PM (5 years ago)
Author:
peterwilsoncc
Message:

Formatting: Prevent wp_targeted_link_rel() adding an empty attribute.

Bypass adding a rel attribute when the wp_targeted_link_rel filter returns an empty string or other falsy result.

Props mcmwebsol, spartank, meatman89fs.
Fixes #45352.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/formatting.php

    r44644 r44691  
    30663066    $rel = apply_filters( 'wp_targeted_link_rel', 'noopener noreferrer', $link_html );
    30673067
     3068    // Avoid additional regex if the filter removes rel values.
     3069    if ( ! $rel ) {
     3070        return "<a $link_html>";
     3071    }
     3072
    30683073    // Value with delimiters, spaces around are optional.
    30693074    $attr_regex = '|rel\s*=\s*?(\\\\{0,1}["\'])(.*?)\\1|i';
Note: See TracChangeset for help on using the changeset viewer.