Make WordPress Core

Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#39698 closed defect (bug) (duplicate)

Notice: Undefined property

Reported by: mitogh's profile mitogh Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords:
Focuses: Cc:


The following error is triggered if DEBUG mode is enabled.

stdClass::$delete_posts in wp-admin/includes/class-wp-posts-list-table.php on line 403.

Where this is happening is here:

if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
// . . .

Based on my next example delete_posts is null when it reaches this line of code.

Specifically this happens if a new post type is created only with just create_posts as capabilities.

Here are the arguments of my post type.

 add_action( 'init', function(){
  $args = array(
      'public' => true,
      'label'  => 'Books',
        'publicly_queryable' => false,
        'exclude_from_search' => true,
        'capabilities' => [
                'create_posts' => false,
    register_post_type( 'book', $args );

I think capabilities, argument should have a default value for delete_posts and any other value that is expected on a post_type.

Change History (2)

#1 @SergeyBiryukov
7 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @mitogh, welcome to Trac!

Thanks for the report, we're already tracking this issue in #30991.

#2 @mitogh
7 years ago


Thank you for the heads up @SergeyBiryukov

Note: See TracTickets for help on using tickets.