WordPress.org

Make WordPress Core

Changeset 28760


Ignore:
Timestamp:
06/17/2014 03:17:36 PM (5 years ago)
Author:
SergeyBiryukov
Message:

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

props Compute.
fixes #28541.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post-template.php

    r28696 r28760  
    474474     * @param int    $post_id The post ID.
    475475     */
    476     return apply_filters( 'post_class', $classes, $class, $post->ID );
     476    $classes = apply_filters( 'post_class', $classes, $class, $post->ID );
     477
     478    return array_unique( $classes );
    477479}
    478480
     
    667669     * @param string $class   A comma-separated list of additional classes added to the body.
    668670     */
    669     return apply_filters( 'body_class', $classes, $class );
     671    $classes = apply_filters( 'body_class', $classes, $class );
     672
     673    return array_unique( $classes );
    670674}
    671675
Note: See TracChangeset for help on using the changeset viewer.