Make WordPress Core

Opened 4 years ago

#49345 new defect (bug)

User with admin privileges cannot edit some pages/posts

Reported by: malamiao's profile malamiao Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.3.2
Component: Role/Capability Keywords: needs-patch
Focuses: Cc:


It happened to me when I deleted the admin user with ID = 1 and moved all its posts and pages to another user with admin privileges. As soon as I did it, some older pages could not be edited anymore (only seen or deleted).

In order to regain control of those pages, I had to patch wp-includes/capabilities.php as follows:

function current_user_can( $capability, ...$args ) {
       $current_user = wp_get_current_user();

       if ( empty( $current_user ) ) {
               return false;

       if ($current_user->has_cap(‘create_users')) return true; // line added

       return $current_user->has_cap( $capability, ...$args );

Change History (0)

Note: See TracTickets for help on using tickets.