WordPress.org

Make WordPress Core


Ignore:
Timestamp:
02/25/2020 12:48:11 PM (22 months ago)
Author:
SergeyBiryukov
Message:

Posts, Post Types: Ensure delete_posts is included in default post type capabilities regardless of map_meta_cap value.

This resolves PHP notices in a few places in core where this capability is checked.

Props Mte90, johnbillion, dipesh.kakadiya, jipmoors, bamadesigner, dd32, johnjamesjacoby, xedin.unknown, flixos90, SergeyBiryukov.
Fixes #30991.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/post.php

    r47317 r47357  
    15101510 * registration, capability_type will always be a string of the singular value.
    15111511 *
    1512  * By default, seven keys are accepted as part of the capabilities array:
     1512 * By default, eight keys are accepted as part of the capabilities array:
    15131513 *
    15141514 * - edit_post, read_post, and delete_post are meta capabilities, which are then
     
    15221522 *   can be edited. If the post type does not support an author, then this will
    15231523 *   behave like edit_posts.
     1524 * - delete_posts - Controls whether objects of this post type can be deleted.
    15241525 * - publish_posts - Controls publishing objects of this post type.
    15251526 * - read_private_posts - Controls whether private objects can be read.
    15261527 *
    1527  * These four primitive capabilities are checked in core in various locations.
    1528  * There are also seven other primitive capabilities which are not referenced
     1528 * These five primitive capabilities are checked in core in various locations.
     1529 * There are also six other primitive capabilities which are not referenced
    15291530 * directly in core, except in map_meta_cap(), which takes the three aforementioned
    15301531 * meta capabilities and translates them into one or more primitive capabilities
     
    15321533 *
    15331534 * - read - Controls whether objects of this post type can be read.
    1534  * - delete_posts - Controls whether objects of this post type can be deleted.
    15351535 * - delete_private_posts - Controls whether private objects can be deleted.
    15361536 * - delete_published_posts - Controls whether published objects can be deleted.
     
    15691569        'edit_posts'         => 'edit_' . $plural_base,
    15701570        'edit_others_posts'  => 'edit_others_' . $plural_base,
     1571        'delete_posts'       => 'delete_' . $plural_base,
    15711572        'publish_posts'      => 'publish_' . $plural_base,
    15721573        'read_private_posts' => 'read_private_' . $plural_base,
     
    15771578        $default_capabilities_for_mapping = array(
    15781579            'read'                   => 'read',
    1579             'delete_posts'           => 'delete_' . $plural_base,
    15801580            'delete_private_posts'   => 'delete_private_' . $plural_base,
    15811581            'delete_published_posts' => 'delete_published_' . $plural_base,
Note: See TracChangeset for help on using the changeset viewer.