Make WordPress Core


Ignore:
Timestamp:
07/08/2013 08:05:42 PM (13 years ago)
Author:
nacin
Message:

Use meta caps edit_post, read_post, and delete_post directly, rather than consulting the post type object. map_meta_cap() handles that for us. props markjaquith, kovshenin. fixes #23226.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/capabilities.php

    r24491 r24593  
    11631163        case 'add_post_meta':
    11641164                $post = get_post( $args[0] );
    1165                 $post_type_object = get_post_type_object( $post->post_type );
    1166                 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
     1165                $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
    11671166
    11681167                $meta_key = isset( $args[ 1 ] ) ? $args[ 1 ] : false;
    … …  
    11791178                $comment = get_comment( $args[0] );
    11801179                $post = get_post( $comment->comment_post_ID );
    1181                 $post_type_object = get_post_type_object( $post->post_type );
    1182 
    1183                 $caps = map_meta_cap( $post_type_object->cap->edit_post, $user_id, $post->ID );
     1180                $caps = map_meta_cap( 'edit_post', $user_id, $post->ID );
    11841181                break;
    11851182        case 'unfiltered_upload':
Note: See TracChangeset for help on using the changeset viewer.