Ticket #42021: 42021.2.diff
File 42021.2.diff, 2.0 KB (added by , 6 years ago) |
---|
-
src/wp-includes/ms-blogs.php
1285 1285 function _update_posts_count_on_delete( $post_id ) { 1286 1286 $post = get_post( $post_id ); 1287 1287 1288 if ( ! $post || 'publish' !== $post->post_status ) {1288 if ( ! $post || 'publish' !== $post->post_status || 'post' !== $post->post_type ) { 1289 1289 return; 1290 1290 } 1291 1291 … … 1296 1296 * Handler for updating the blog posts count date when a post status changes. 1297 1297 * 1298 1298 * @since 4.0.0 1299 * @since 4.9.0 Added the `$post` parameter. 1299 1300 * 1300 * @param string $new_status The status the post is changing to. 1301 * @param string $old_status The status the post is changing from. 1301 * @param string $new_status The status the post is changing to. 1302 * @param string $old_status The status the post is changing from. 1303 * @param WP_Post $post Post object 1302 1304 */ 1303 function _update_posts_count_on_transition_post_status( $new_status, $old_status ) {1305 function _update_posts_count_on_transition_post_status( $new_status, $old_status, $post = null ) { 1304 1306 if ( $new_status === $old_status ) { 1305 1307 return; 1306 1308 } 1307 1309 1310 if ( 'post' !== get_post_type( $post ) ) { 1311 return; 1312 } 1313 1308 1314 if ( 'publish' !== $new_status && 'publish' !== $old_status ) { 1309 1315 return; 1310 1316 } -
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');