Prevent get_post_class() and get_body_class() from returning duplicate classes.

props Compute.
fixes #28541.
Built from https://develop.svn.wordpress.org/trunk@28760


git-svn-id: http://core.svn.wordpress.org/trunk@28573 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2014-06-17 15:18:16 +00:00
parent c171f2ef77
commit e85c3deba5
1 changed files with 6 additions and 2 deletions

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 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 );
}
/**