#39698 closed defect (bug) (duplicate)
Notice: Undefined property
Reported by: | mitogh | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description
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.
<?php 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)
Note: See
TracTickets for help on using
tickets.
Hi @mitogh, welcome to Trac!
Thanks for the report, we're already tracking this issue in #30991.