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:
parent
c171f2ef77
commit
e85c3deba5
|
@ -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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue