WordPress.org

Make WordPress Core

Ticket #18624: 18624.2.diff

File 18624.2.diff, 1.9 KB (added by ryan, 7 years ago)

Get fancy

  • wp-includes/ms-default-filters.php

     
    3636add_filter( 'term_id_filter', 'global_terms', 10, 2 );
    3737add_action( 'publish_post', 'update_posts_count' );
    3838add_action( 'delete_post', 'wpmu_update_blogs_date' );
    39 add_action( 'publish_post', 'wpmu_update_blogs_date' );
     39add_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');
    4242
  • wp-includes/ms-blogs.php

     
    687687        return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
    688688}
    689689
     690/**
     691 * Handler for updating the blog date when a post is published or an already published post is changed.
     692 *
     693 * @since 3.3.0
     694 *
     695 * @param string $new_status The new post status
     696 * @param string $old_status The old post status
     697 * @param object $post Post object
     698 */
     699function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
     700        $post_type_obj = get_post_type_object( $post->post_type );
     701        if ( ! $post_type_obj->publicly_queryable )
     702                return;
     703
     704        if ( 'publish' != $new_status && 'publish' != $old_status )
     705                return;
     706
     707        // Post was freshly published, published post was saved, or published post was unpublished.
     708
     709        wpmu_update_blogs_date();
     710}
     711
    690712?>