WordPress.org

Make WordPress Core

Ticket #28541: 28541.diff

File 28541.diff, 892 bytes (added by Compute, 5 years ago)

array_unique( $classes ) before returning classes

  • wp-includes/post-template.php

     
    473473         * @param string $class   A comma-separated list of additional classes added to the post.
    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
    479481/**
     
    666668         * @param array  $classes An array of body classes.
    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
    672676/**