WordPress.org

Make WordPress Core

Ticket #16603: 16603-wp_count_posts-filter.diff

File 16603-wp_count_posts-filter.diff, 474 bytes (added by hardy101, 21 months ago)

Filter wp_count_posts before populating the cache

  • wp-includes/post.php

     
    18971897               $stats[$row['post_status']] = $row['num_posts']; 
    18981898 
    18991899       $stats = (object) $stats; 
     1900       $stats = apply_filters( 'wp_count_posts', $stats, $type, $perm ); 
    19001901       wp_cache_set($cache_key, $stats, 'counts'); 
    19011902 
    19021903       return $stats;