WordPress.org

Make WordPress Core

Changeset 19129


Ignore:
Timestamp:
11/03/2011 05:06:45 PM (9 years ago)
Author:
ryan
Message:

Update the blog date whenever a pubic post type is published or changed after being published. fixes #18624

Location:
trunk/wp-includes
Files:
2 edited

Legend:

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

    r18662 r19129  
    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->public )
     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?>
  • trunk/wp-includes/ms-default-filters.php

    r18657 r19129  
    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');
Note: See TracChangeset for help on using the changeset viewer.