Themes: Add additional later escaping to `post_class()` and `body_class()` functions.
Additionally, this adds a few tests to test output. Fixes #20009. Props mfields, scribu, azaozz, obenland, dd32, nacin, jrf, jdgrimes, garyj, whyisjake. Built from https://develop.svn.wordpress.org/trunk@48060 git-svn-id: http://core.svn.wordpress.org/trunk@47827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f83c504b88
commit
ed1e6c3d87
|
@ -454,7 +454,7 @@ function has_excerpt( $post = 0 ) {
|
||||||
*/
|
*/
|
||||||
function post_class( $class = '', $post_id = null ) {
|
function post_class( $class = '', $post_id = null ) {
|
||||||
// Separates classes with a single space, collates classes for post DIV.
|
// Separates classes with a single space, collates classes for post DIV.
|
||||||
echo 'class="' . join( ' ', get_post_class( $class, $post_id ) ) . '"';
|
echo 'class="' . esc_attr( join( ' ', get_post_class( $class, $post_id ) ) ) . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -590,7 +590,7 @@ function get_post_class( $class = '', $post_id = null ) {
|
||||||
*/
|
*/
|
||||||
function body_class( $class = '' ) {
|
function body_class( $class = '' ) {
|
||||||
// Separates class names with a single space, collates class names for body element.
|
// Separates class names with a single space, collates class names for body element.
|
||||||
echo 'class="' . join( ' ', get_body_class( $class ) ) . '"';
|
echo 'class="' . esc_attr( join( ' ', get_body_class( $class ) ) ) . '"';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.5-alpha-48059';
|
$wp_version = '5.5-alpha-48060';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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