diff --git src/wp-includes/post.php src/wp-includes/post.php
index 491fc666a4..bd5768bedb 100644
|
|
function unregister_post_type( $post_type ) { |
1485 | 1485 | * Otherwise, an 's' will be added to the value for the plural form. After |
1486 | 1486 | * registration, capability_type will always be a string of the singular value. |
1487 | 1487 | * |
1488 | | * By default, seven keys are accepted as part of the capabilities array: |
| 1488 | * By default, eight keys are accepted as part of the capabilities array: |
1489 | 1489 | * |
1490 | 1490 | * - edit_post, read_post, and delete_post are meta capabilities, which are then |
1491 | 1491 | * generally mapped to corresponding primitive capabilities depending on the |
… |
… |
function unregister_post_type( $post_type ) { |
1497 | 1497 | * - edit_others_posts - Controls whether objects of this type owned by other users |
1498 | 1498 | * can be edited. If the post type does not support an author, then this will |
1499 | 1499 | * behave like edit_posts. |
| 1500 | * - delete_posts - Controls whether objects of this post type can be deleted. |
1500 | 1501 | * - publish_posts - Controls publishing objects of this post type. |
1501 | 1502 | * - read_private_posts - Controls whether private objects can be read. |
1502 | 1503 | * |
1503 | 1504 | * These four primitive capabilities are checked in core in various locations. |
1504 | | * There are also seven other primitive capabilities which are not referenced |
| 1505 | * There are also six other primitive capabilities which are not referenced |
1505 | 1506 | * directly in core, except in map_meta_cap(), which takes the three aforementioned |
1506 | 1507 | * meta capabilities and translates them into one or more primitive capabilities |
1507 | 1508 | * that must then be checked against the user or role, depending on the context. |
1508 | 1509 | * |
1509 | 1510 | * - read - Controls whether objects of this post type can be read. |
1510 | | * - delete_posts - Controls whether objects of this post type can be deleted. |
1511 | 1511 | * - delete_private_posts - Controls whether private objects can be deleted. |
1512 | 1512 | * - delete_published_posts - Controls whether published objects can be deleted. |
1513 | 1513 | * - delete_others_posts - Controls whether objects owned by other users can be |
… |
… |
function get_post_type_capabilities( $args ) { |
1541 | 1541 | 'edit_post' => 'edit_' . $singular_base, |
1542 | 1542 | 'read_post' => 'read_' . $singular_base, |
1543 | 1543 | 'delete_post' => 'delete_' . $singular_base, |
| 1544 | 'delete_posts' => 'delete_' . $plural_base, |
1544 | 1545 | // Primitive capabilities used outside of map_meta_cap(): |
1545 | 1546 | 'edit_posts' => 'edit_' . $plural_base, |
1546 | 1547 | 'edit_others_posts' => 'edit_others_' . $plural_base, |
… |
… |
function get_post_type_capabilities( $args ) { |
1552 | 1553 | if ( $args->map_meta_cap ) { |
1553 | 1554 | $default_capabilities_for_mapping = array( |
1554 | 1555 | 'read' => 'read', |
1555 | | 'delete_posts' => 'delete_' . $plural_base, |
1556 | 1556 | 'delete_private_posts' => 'delete_private_' . $plural_base, |
1557 | 1557 | 'delete_published_posts' => 'delete_published_' . $plural_base, |
1558 | 1558 | 'delete_others_posts' => 'delete_others_' . $plural_base, |
diff --git tests/phpunit/tests/user/mapMetaCap.php tests/phpunit/tests/user/mapMetaCap.php
index dc67dfeef9..5ce1a19a1a 100644
|
|
class Tests_User_MapMetaCap extends WP_UnitTestCase { |
82 | 82 | array( 'delete_others_posts', 'delete_private_posts' ), |
83 | 83 | map_meta_cap( 'delete_post', self::$user_id, self::$post_id ) |
84 | 84 | ); |
| 85 | $this->assertEquals( |
| 86 | array( 'delete_posts' ), |
| 87 | map_meta_cap( $post_type_object->cap->delete_posts, self::$user_id, self::$post_id ) |
| 88 | ); |
85 | 89 | $this->assertEquals( |
86 | 90 | array( 'delete_others_posts', 'delete_private_posts' ), |
87 | 91 | map_meta_cap( $post_type_object->cap->delete_post, self::$user_id, self::$post_id ) |