WordPress.org

Make WordPress Core

Changeset 20461


Ignore:
Timestamp:
04/13/2012 05:30:37 PM (9 years ago)
Author:
ryan
Message:

Don't update a blog's last_updated time for all post deletions. Update only when published posts are deleted.

Props SergeyBiryukov
fixes #20433

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/ms-blogs.php

    r19889 r20461  
    711711    wpmu_update_blogs_date();
    712712}
     713
     714/**
     715 * Handler for updating the blog date when a published post is deleted.
     716 *
     717 * @since 3.4.0
     718 *
     719 * @param int $post_id Post ID
     720 */
     721function _update_blog_date_on_post_delete( $post_id ) {
     722    $post = get_post( $post_id );
     723
     724    $post_type_obj = get_post_type_object( $post->post_type );
     725    if ( ! $post_type_obj->public )
     726        return;
     727
     728    if ( 'publish' != $post->post_status )
     729        return;
     730
     731    wpmu_update_blogs_date();
     732}
     733
  • trunk/wp-includes/ms-default-filters.php

    r19712 r20461  
    3636add_filter( 'term_id_filter', 'global_terms', 10, 2 );
    3737add_action( 'publish_post', 'update_posts_count' );
    38 add_action( 'delete_post', 'wpmu_update_blogs_date' );
     38add_action( 'delete_post', '_update_blog_date_on_post_delete' );
    3939add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
    4040add_action( 'admin_init', 'wp_schedule_update_network_counts');
Note: See TracChangeset for help on using the changeset viewer.