WordPress.org

Make WordPress Core


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

    r24304 r24593  
    140140        wp_die( __( 'Unknown post type.' ) );
    141141
    142     if ( ! current_user_can( $post_type_object->cap->edit_post, $post_id ) )
     142    if ( ! current_user_can( 'edit_post', $post_id ) )
    143143        wp_die( __( 'You are not allowed to edit this item.' ) );
    144144
     
    236236        wp_die( __( 'Unknown post type.' ) );
    237237
    238     if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
     238    if ( ! current_user_can( 'delete_post', $post_id ) )
    239239        wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
    240240
     
    260260        wp_die( __( 'Unknown post type.' ) );
    261261
    262     if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
     262    if ( ! current_user_can( 'delete_post', $post_id ) )
    263263        wp_die( __( 'You are not allowed to move this item out of the Trash.' ) );
    264264
     
    279279        wp_die( __( 'Unknown post type.' ) );
    280280
    281     if ( ! current_user_can( $post_type_object->cap->delete_post, $post_id ) )
     281    if ( ! current_user_can( 'delete_post', $post_id ) )
    282282        wp_die( __( 'You are not allowed to delete this item.' ) );
    283283
Note: See TracChangeset for help on using the changeset viewer.