Ticket #42021: post_counts.diff
File post_counts.diff, 1.6 KB (added by , 6 years ago) |
---|
-
wp-includes/ms-blogs.php
1311 1311 * 1312 1312 * @param string $new_status The status the post is changing to. 1313 1313 * @param string $old_status The status the post is changing from. 1314 * @param object $post Post object 1314 1315 */ 1315 function _update_posts_count_on_transition_post_status( $new_status, $old_status ) {1316 function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post ) { 1316 1317 if ( $new_status === $old_status ) { 1317 1318 return; 1318 1319 } 1319 1320 1321 if ( ! empty( $post->post_type ) && 'post' !== $post->post_type ){ 1322 return; // update_posts_count only looks for the posts post type so no need to run this when a different post type is being touched. 1323 } 1324 1320 1325 if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 1321 1326 return; 1322 1327 } -
wp-includes/ms-default-filters.php
51 51 add_action( 'delete_post', '_update_posts_count_on_delete' ); 52 52 add_action( 'delete_post', '_update_blog_date_on_post_delete' ); 53 53 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 ); 54 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2);54 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 ); 55 55 56 56 // Counts 57 57 add_action( 'admin_init', 'wp_schedule_update_network_counts');