From 3a46ff98f54e2bdff0423055c2836ec553dad404 Mon Sep 17 00:00:00 2001 From: Andrew Nacin Date: Wed, 9 Oct 2013 19:13:28 +0000 Subject: [PATCH] Only add one body class when multiple post types manage to be present for a post type archive due to pre_get_posts manipulation. fixes #25341. git-svn-id: https://develop.svn.wordpress.org/trunk@25745 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-template.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index c6b73e0d53..9b3fe46f73 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -458,8 +458,10 @@ function get_body_class( $class = '' ) { } elseif ( is_archive() ) { if ( is_post_type_archive() ) { $classes[] = 'post-type-archive'; - foreach ( (array) get_query_var( 'post_type' ) as $post_type ) - $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); + $post_type = get_query_var( 'post_type' ); + if ( is_array( $post_type ) ) + $post_type = reset( $post_type ); + $classes[] = 'post-type-archive-' . sanitize_html_class( $post_type ); } else if ( is_author() ) { $author = $wp_query->get_queried_object(); $classes[] = 'author';