WordPress.org

Make WordPress Core

Changeset 29318


Ignore:
Timestamp:
07/29/2014 12:50:53 AM (7 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.

Location:
trunk/src/wp-includes
Files:
2 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();
  • trunk/src/wp-includes/post.php

    r29113 r29318  
    23152315    if ( 'readable' == $perm && is_user_logged_in() ) {
    23162316        $post_type_object = get_post_type_object( $type );
    2317         if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
     2317        if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
    23182318            $cache_key .= '_' . $perm . '_' . get_current_user_id();
    23192319        }
Note: See TracChangeset for help on using the changeset viewer.