Opened 7 years ago
#49345 new defect (bug)
User with admin privileges cannot edit some pages/posts
| Reported by: | malamiao | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Role/Capability | Version: | 5.3.2 |
| Severity: | normal | Keywords: | needs-patch |
| Cc: | Focuses: |
Description
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 );
}
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)