WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/17/2019 12:08:50 PM (6 months ago)
Author:
SergeyBiryukov
Message:

Formatting: Adjust wp_targeted_link_rel() to ensure JSON format is preserved and correct quotes are used when adding the missing rel attribute.

Props birgire, TobiasBg, fierevere, audrasjb, SergeyBiryukov.
Fixes #46316, #47244.

File:
1 edited

Legend:

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

    r45240 r45348  
    30953095        $rel       = 'rel=' . $delimiter . trim( implode( ' ', $parts ) ) . $delimiter;
    30963096        $link_html = str_replace( $rel_match[0], $rel, $link_html );
     3097    } elseif ( preg_match( '|target\s*=\s*?\\\\"|', $link_html ) ) {
     3098        $link_html .= " rel=\\\"$rel\\\"";
     3099    } elseif ( preg_match( '#(target|href)\s*=\s*?\'#', $link_html ) ) {
     3100        $link_html .= " rel='$rel'";
    30973101    } else {
    30983102        $link_html .= " rel=\"$rel\"";
Note: See TracChangeset for help on using the changeset viewer.