WordPress.org

Make WordPress Core

Ticket #20433: 20433.2.patch

File 20433.2.patch, 1.4 KB (added by SergeyBiryukov, 6 years ago)
  • wp-includes/ms-blogs.php

     
    710710
    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
  • wp-includes/ms-default-filters.php

     
    3535// Administration
    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');
    4141add_action( 'update_network_counts', 'wp_update_network_counts');