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. Built from https://develop.svn.wordpress.org/trunk@45348 git-svn-id: http://core.svn.wordpress.org/trunk@45159 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e68fe165ae
commit
c1f6c6877c
|
@ -3094,6 +3094,10 @@ function wp_targeted_link_rel_callback( $matches ) {
|
||||||
$delimiter = trim( $rel_match[1] ) ? $rel_match[1] : '"';
|
$delimiter = trim( $rel_match[1] ) ? $rel_match[1] : '"';
|
||||||
$rel = 'rel=' . $delimiter . trim( implode( ' ', $parts ) ) . $delimiter;
|
$rel = 'rel=' . $delimiter . trim( implode( ' ', $parts ) ) . $delimiter;
|
||||||
$link_html = str_replace( $rel_match[0], $rel, $link_html );
|
$link_html = str_replace( $rel_match[0], $rel, $link_html );
|
||||||
|
} elseif ( preg_match( '|target\s*=\s*?\\\\"|', $link_html ) ) {
|
||||||
|
$link_html .= " rel=\\\"$rel\\\"";
|
||||||
|
} elseif ( preg_match( '#(target|href)\s*=\s*?\'#', $link_html ) ) {
|
||||||
|
$link_html .= " rel='$rel'";
|
||||||
} else {
|
} else {
|
||||||
$link_html .= " rel=\"$rel\"";
|
$link_html .= " rel=\"$rel\"";
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.3-alpha-45346';
|
$wp_version = '5.3-alpha-45348';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue