WordPress.org

Make WordPress Core

Ticket #37114: 37144.diff

File 37144.diff, 808 bytes (added by desrosj, 4 years ago)

Patch combining the two scenarios in one filter.

  • src/wp-includes/post-template.php

     
    507507
    508508        // All public taxonomies
    509509        $taxonomies = get_taxonomies( array( 'public' => true ) );
     510
     511        /**
     512         * Filters the taxonomies to show term classes for.
     513         *
     514         * @since 4.7.0
     515         *
     516         * @param array $taxonomies Public taxonomy names to show term classes for.
     517         * @param WP_Post $post Post object.
     518         */
     519        $taxonomies = apply_filters( 'post_class_taxonomies', $taxonomies, $post );
     520
    510521        foreach ( (array) $taxonomies as $taxonomy ) {
    511522                if ( is_object_in_taxonomy( $post->post_type, $taxonomy ) ) {
    512523                        foreach ( (array) get_the_terms( $post->ID, $taxonomy ) as $term ) {