WordPress.org

Make WordPress Core

Ticket #20635: 20635.2.diff

File 20635.2.diff, 1.4 KB (added by wonderboymusic, 6 years ago)
  • wp-includes/default-filters.php

    diff --git a/wp-includes/default-filters.php b/wp-includes/default-filters.php
    index 531fd53..721efaf 100644
    a b foreach ( array( 'term_name_rss' ) as $filter ) { 
    127127add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
    128128add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
    129129
     130// Pad terms count hierarchy loop detection
     131add_filter( '_pad_term_counts_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
     132
    130133// Display filters
    131134add_filter( 'the_title', 'wptexturize'   );
    132135add_filter( 'the_title', 'convert_chars' );
  • wp-includes/taxonomy.php

    diff --git a/wp-includes/taxonomy.php b/wp-includes/taxonomy.php
    index 955369e..2bdd7fd 100644
    a b function _pad_term_counts(&$terms, $taxonomy) { 
    29692969        foreach ( $term_ids as $term_id ) {
    29702970                $child = $term_id;
    29712971                while ( !empty( $terms_by_id[$child] ) && $parent = $terms_by_id[$child]->parent ) {
     2972
     2973                        // Check $parent to see if it will cause a hierarchy loop
     2974                        $parent = apply_filters( '_pad_term_counts_term_parent', $parent, $term_id, $taxonomy );
     2975
    29722976                        if ( !empty( $term_items[$term_id] ) )
    29732977                                foreach ( $term_items[$term_id] as $item_id => $touches ) {
    29742978                                        $term_items[$parent][$item_id] = isset($term_items[$parent][$item_id]) ? ++$term_items[$parent][$item_id]: 1;