Make WordPress Core


Ignore:
Timestamp:
02/25/2020 12:48:11 PM (6 years 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/tests/phpunit/tests/user/mapMetaCap.php

    r46586 r47357  
    305305        }
    306306
     307        /**
     308         * @ticket 30991
     309         */
     310        function test_delete_posts_cap_without_map_meta_cap() {
     311                register_post_type(
     312                        self::$post_type,
     313                        array(
     314                                'capability_type' => 'post',
     315                                'map_meta_cap'    => false,
     316                        )
     317                );
     318
     319                $post_type_object = get_post_type_object( self::$post_type );
     320
     321                $this->assertFalse( $post_type_object->map_meta_cap );
     322                $this->assertEquals( 'delete_posts', $post_type_object->cap->delete_posts );
     323        }
     324
    307325        function test_unfiltered_html_cap() {
    308326                if ( defined( 'DISALLOW_UNFILTERED_HTML' ) ) {
Note: See TracChangeset for help on using the changeset viewer.