Make WordPress Core

Ticket #16956: 16956.8.diff

File 16956.8.diff, 1.3 KB (added by boonebgorges, 9 years ago)
  • src/wp-includes/capabilities-functions.php

    diff --git src/wp-includes/capabilities-functions.php src/wp-includes/capabilities-functions.php
    index 4274fa5..e0c07a4 100644
    function map_meta_cap( $cap, $user_id ) { 
    5252                }
    5353
    5454                $post_type = get_post_type_object( $post->post_type );
     55                if ( ! $post_type ) {
     56                        $cap = 'edit_others_posts';
     57                        break;
     58                }
    5559
    5660                if ( ! $post_type->map_meta_cap ) {
    5761                        $caps[] = $post_type->cap->$cap;
    function map_meta_cap( $cap, $user_id ) { 
    100104                }
    101105
    102106                $post_type = get_post_type_object( $post->post_type );
     107                if ( ! $post_type ) {
     108                        $cap = 'edit_others_posts';
     109                        break;
     110                }
    103111
    104112                if ( ! $post_type->map_meta_cap ) {
    105113                        $caps[] = $post_type->cap->$cap;
    function map_meta_cap( $cap, $user_id ) { 
    142150                }
    143151
    144152                $post_type = get_post_type_object( $post->post_type );
     153                if ( ! $post_type ) {
     154                        $cap = 'edit_others_posts';
     155                        break;
     156                }
    145157
    146158                if ( ! $post_type->map_meta_cap ) {
    147159                        $caps[] = $post_type->cap->$cap;
    function map_meta_cap( $cap, $user_id ) { 
    168180        case 'publish_post':
    169181                $post = get_post( $args[0] );
    170182                $post_type = get_post_type_object( $post->post_type );
     183                if ( ! $post_type ) {
     184                        $cap = 'edit_others_posts';
     185                        break;
     186                }
    171187
    172188                $caps[] = $post_type->cap->publish_posts;
    173189                break;