Make WordPress Core


Ignore:
Timestamp:
07/08/2013 08:05:42 PM (12 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-admin/edit.php

    r24207 r24593  
    7979
    8080            foreach( (array) $post_ids as $post_id ) {
    81                 if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
     81                if ( !current_user_can( 'delete_post', $post_id) )
    8282                    wp_die( __('You are not allowed to move this item to the Trash.') );
    8383
     
    9898            $untrashed = 0;
    9999            foreach( (array) $post_ids as $post_id ) {
    100                 if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
     100                if ( !current_user_can( 'delete_post', $post_id) )
    101101                    wp_die( __('You are not allowed to restore this item from the Trash.') );
    102102
     
    113113                $post_del = get_post($post_id);
    114114
    115                 if ( !current_user_can($post_type_object->cap->delete_post, $post_id) )
     115                if ( !current_user_can( 'delete_post', $post_id ) )
    116116                    wp_die( __('You are not allowed to delete this item.') );
    117117
Note: See TracChangeset for help on using the changeset viewer.