Ticket #42021: 42021.diff
File 42021.diff, 1.7 KB (added by , 6 years ago) |
---|
-
src/wp-includes/ms-blogs.php
1299 1299 * 1300 1300 * @since 4.0.0 1301 1301 * 1302 * @param string $new_status The status the post is changing to. 1303 * @param string $old_status The status the post is changing from. 1302 * @param string $new_status The status the post is changing to. 1303 * @param string $old_status The status the post is changing from. 1304 * @param WP_Post $post Post object 1304 1305 */ 1305 function _update_posts_count_on_transition_post_status( $new_status, $old_status ) {1306 function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) { 1306 1307 if ( $new_status === $old_status ) { 1307 1308 return; 1308 1309 } 1309 1310 1311 // update_posts_count() only looks for the 'post' post type, so skip any other type. 1312 if ( 'post' !== get_post_type( $post ) ) { 1313 return; 1314 } 1315 1310 1316 if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 1311 1317 return; 1312 1318 } -
src/wp-includes/ms-default-filters.php
54 54 add_action( 'delete_post', '_update_posts_count_on_delete' ); 55 55 add_action( 'delete_post', '_update_blog_date_on_post_delete' ); 56 56 add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 ); 57 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2);57 add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 3 ); 58 58 59 59 // Counts 60 60 add_action( 'admin_init', 'wp_schedule_update_network_counts');