From 66307dc19dfbbe1ac8b3a24ae2821b0ee11cdb92 Mon Sep 17 00:00:00 2001 From: Peter Westwood Date: Tue, 7 Jun 2011 08:55:25 +0000 Subject: [PATCH] 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: https://develop.svn.wordpress.org/trunk@18176 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post-template.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 593846e0b1..a2f5d1a563 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -529,10 +529,13 @@ function get_body_class( $class = '' ) { $classes[] = 'post-type-paged-' . $page; } - if ( !empty( $class ) ) { + if ( ! empty( $class ) ) { if ( !is_array( $class ) ) $class = preg_split( '#\s+#', $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 );