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
This commit is contained in:
Sergey Biryukov 2014-06-17 15:17:36 +00:00
parent 177d39a15b
commit abddfc4b99

View File

@ -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 string $class A comma-separated list of additional classes added to the post.
* @param int $post_id The post ID. * @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 array $classes An array of body classes.
* @param string $class A comma-separated list of additional classes added to the body. * @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 );
} }
/** /**