Make WordPress Core


Ignore:
Timestamp:
07/29/2014 12:50:53 AM (10 years ago)
Author:
SergeyBiryukov
Message:

Avoid PHP notices in _count_posts_cache_key(), _update_blog_date_on_post_publish(), and _update_blog_date_on_post_delete() if post type is not registered.

props jesin.
fixes #28135.

File:
1 edited

Legend:

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

    r29163 r29318  
    875875function _update_blog_date_on_post_publish( $new_status, $old_status, $post ) {
    876876    $post_type_obj = get_post_type_object( $post->post_type );
    877     if ( ! $post_type_obj->public )
     877    if ( ! $post_type_obj || ! $post_type_obj->public ) {
    878878        return;
    879 
    880     if ( 'publish' != $new_status && 'publish' != $old_status )
     879    }
     880
     881    if ( 'publish' != $new_status && 'publish' != $old_status ) {
    881882        return;
     883    }
    882884
    883885    // Post was freshly published, published post was saved, or published post was unpublished.
     
    897899
    898900    $post_type_obj = get_post_type_object( $post->post_type );
    899     if ( ! $post_type_obj->public )
     901    if ( ! $post_type_obj || ! $post_type_obj->public ) {
    900902        return;
    901 
    902     if ( 'publish' != $post->post_status )
     903    }
     904
     905    if ( 'publish' != $post->post_status ) {
    903906        return;
     907    }
    904908
    905909    wpmu_update_blogs_date();
Note: See TracChangeset for help on using the changeset viewer.