From abddfc4b99d5d4003f7e8652ce4dc78f44b76cd7 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 17 Jun 2014 15:17:36 +0000 Subject: [PATCH] Prevent get_post_class() and get_body_class() from returning duplicate classes. props Compute. fixes #28541. git-svn-id: https://develop.svn.wordpress.org/trunk@28760 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/post-template.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index 1f96b448e9..ed49895ecd 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -473,7 +473,9 @@ function get_post_class( $class = '', $post_id = null ) { * @param string $class A comma-separated list of additional classes added to the post. * @param int $post_id The post ID. */ - return apply_filters( 'post_class', $classes, $class, $post->ID ); + $classes = apply_filters( 'post_class', $classes, $class, $post->ID ); + + return array_unique( $classes ); } /** @@ -666,7 +668,9 @@ function get_body_class( $class = '' ) { * @param array $classes An array of body classes. * @param string $class A comma-separated list of additional classes added to the body. */ - return apply_filters( 'body_class', $classes, $class ); + $classes = apply_filters( 'body_class', $classes, $class ); + + return array_unique( $classes ); } /**