Opened 5 years ago
Closed 5 years ago
#47836 closed defect (bug) (duplicate)
PHP Notice: Undefined property: stdClass::$delete_posts in wp-admin/includes/class-wp-posts-list-table.ph file
Reported by: | AkSDvP | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 5.3 |
Component: | Posts, Post Types | Keywords: | |
Focuses: | Cc: |
Description (last modified by )
Hi Team,
Following PHP warning is being observed while rendering Manage Posts links in the admin section.
PHP Notice: Undefined property: stdClass::$delete_posts in /var/www/html/wp-sandbox/wp-admin/includes/class-wp-posts-list-table.php on line 413
I would suggest to include isset() check statement to check if ($post_type_obj->cap->delete_posts) exists, before the current condition, that I think will handle the warning.
So I suggest modifying the following code -
if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete Permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } }
with
if ( isset( $post_type_obj->cap->delete_posts ) ) { if ( current_user_can( $post_type_obj->cap->delete_posts ) ) { if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) { $actions['delete'] = __( 'Delete Permanently' ); } else { $actions['trash'] = __( 'Move to Trash' ); } } }
Please find the source code link for reference.
Kindly advise if this can be considered to be addressed.
Thanks.
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hi @AkSDvP, welcome to WordPress Trac!
Thanks for the report, we're already tracking this issue in #30991.