Ensure that we always coerce the class list passed to get_body_class to an array even when it is empty. Fixes #17717
git-svn-id: http://svn.automattic.com/wordpress/trunk@18176 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
927a1b04dc
commit
bb74249c0d
|
@ -529,10 +529,13 @@ function get_body_class( $class = '' ) {
|
||||||
$classes[] = 'post-type-paged-' . $page;
|
$classes[] = 'post-type-paged-' . $page;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !empty( $class ) ) {
|
if ( ! empty( $class ) ) {
|
||||||
if ( !is_array( $class ) )
|
if ( !is_array( $class ) )
|
||||||
$class = preg_split( '#\s+#', $class );
|
$class = preg_split( '#\s+#', $class );
|
||||||
$classes = array_merge( $classes, $class );
|
$classes = array_merge( $classes, $class );
|
||||||
|
} else {
|
||||||
|
// Ensure that we always coerce class to being an array.
|
||||||
|
$class = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
$classes = array_map( 'esc_attr', $classes );
|
$classes = array_map( 'esc_attr', $classes );
|
||||||
|
|
Loading…
Reference in New Issue