Don't update a blog's last_updated time for all post deletions. Update only when published posts are deleted.
Props SergeyBiryukov fixes #20433 git-svn-id: https://develop.svn.wordpress.org/trunk@20461 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
acfa043b2a
commit
8caae7f602
wp-includes
@ -710,3 +710,24 @@ function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
|
||||
|
||||
wpmu_update_blogs_date();
|
||||
}
|
||||
|
||||
/**
|
||||
* Handler for updating the blog date when a published post is deleted.
|
||||
*
|
||||
* @since 3.4.0
|
||||
*
|
||||
* @param int $post_id Post ID
|
||||
*/
|
||||
function _update_blog_date_on_post_delete( $post_id ) {
|
||||
$post = get_post( $post_id );
|
||||
|
||||
$post_type_obj = get_post_type_object( $post->post_type );
|
||||
if ( ! $post_type_obj->public )
|
||||
return;
|
||||
|
||||
if ( 'publish' != $post->post_status )
|
||||
return;
|
||||
|
||||
wpmu_update_blogs_date();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
|
||||
// Administration
|
||||
add_filter( 'term_id_filter', 'global_terms', 10, 2 );
|
||||
add_action( 'publish_post', 'update_posts_count' );
|
||||
add_action( 'delete_post', 'wpmu_update_blogs_date' );
|
||||
add_action( 'delete_post', '_update_blog_date_on_post_delete' );
|
||||
add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
|
||||
add_action( 'admin_init', 'wp_schedule_update_network_counts');
|
||||
add_action( 'update_network_counts', 'wp_update_network_counts');
|
||||
|
Loading…
x
Reference in New Issue
Block a user