Make WordPress Core

Ticket #31199: 31199-2.patch

File 31199-2.patch, 1.0 KB (added by chriscct7, 4 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    400400                $actions       = array();
    401401                $post_type_obj = get_post_type_object( $this->screen->post_type );
    402402
    403                 if ( current_user_can( $post_type_obj->cap->edit_posts ) ) {
     403                if ( empty( $post_type_object ) ) {
     404                        return $actions;
     405                }
     406
     407                if ( ! empty( $post_type_obj->cap->edit_posts ) && current_user_can( $post_type_obj->cap->edit_posts ) ) {
    404408                        if ( $this->is_trash ) {
    405409                                $actions['untrash'] = __( 'Restore' );
    406410                        } else {
     
    408412                        }
    409413                }
    410414
    411                 if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
     415                if ( ! empty( $post_type_obj->cap->delete_posts ) && current_user_can( $post_type_obj->cap->delete_posts ) ) {
    412416                        if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
    413417                                $actions['delete'] = __( 'Delete Permanently' );
    414418                        } else {