Formatting: Preserve target="_blank" in Biographical Info and Category Description.

This changeset ensures the `target="_blank"` attribute is preserved when adding links in the Biographical Info and Category Description fields. Previously, this attribute was being stripped by the KSES sanitization process.

Additionally, new unit tests have been added to verify the preservation of the `target="_blank"` attribute in these specific contexts.

Props lovewpmu, miqrogroove, bsutcliffe, sjefen6, nofearinc, nacin, harmr, blogitsolutions, stefahn, nirajgirixd, martinkrcho, spacedmonkey, sukhendu2002, audrasjb, gaellebesson, nuryko, guillaumeturpin, maximemeganck, ranafge, azaozz, joedolson, rinkalpagdar, mikinc860.
Fixes #12056.



Built from https://develop.svn.wordpress.org/trunk@59677


git-svn-id: http://core.svn.wordpress.org/trunk@59020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
audrasjb 2025-01-21 22:59:18 +00:00
parent c84a324ab2
commit a79b4ef4c9
2 changed files with 5 additions and 3 deletions

View File

@ -895,9 +895,11 @@ function wp_kses_allowed_html( $context = '' ) {
return $tags; return $tags;
case 'user_description': case 'user_description':
case 'pre_term_description':
case 'pre_user_description': case 'pre_user_description':
$tags = $allowedtags; $tags = $allowedtags;
$tags['a']['rel'] = true; $tags['a']['rel'] = true;
$tags['a']['target'] = true;
/** This filter is documented in wp-includes/kses.php */ /** This filter is documented in wp-includes/kses.php */
return apply_filters( 'wp_kses_allowed_html', $tags, $context ); return apply_filters( 'wp_kses_allowed_html', $tags, $context );

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.8-alpha-59676'; $wp_version = '6.8-alpha-59677';
/** /**
* 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.