The administrator role on a WordPress site may become corrupted or malfunction, resulting in unexpected behavior or limited access for the admin user. This corruption can occur due to various factors, such as conflicts with plugins or themes, database issues, or incorrect user role settings.
When admin role corruption happens, the affected user may experience difficulties in performing administrative tasks, accessing certain features, or even logging into the admin area. Resolving admin role corruption often involves troubleshooting and identifying the underlying cause, which may require disabling problematic plugins, checking database integrity, or resetting user roles and permissions. By addressing the corruption issue, administrators can restore the proper functioning and privileges of the admin role in WordPress.
This covers creating and resetting the administrator role on a WordPress site.
Reset Administrator Role
NOTE: It is first recommended to confirm that the user that is being used has the administrator role. This can be done by running wp user list
within the site's document root. If any users that are supposed to be administrators actually are listed as an administrator, the steps provided should assist with this issue. If they don't have the administrator role, update the user role after creating the role.
- SSH into the server
- Locate the site's document root
- Change directories to the document root for the specific site using
cd public_html
REPLACE: public_html with the actual path to the site's document root. - To create the admin user role, run
wp role create administrator Administrator
IMPORTANT: If the role already exists, you will see an error that the role couldn't be created. This can be disregarded. - To ensure the correct privileges are set for the role, run
wp role reset administrator
EXAMPLE: - Attempt logging in again to determine if the issue is resolved
TIP: Refer to the WP-CLI documentation on creating WordPress Roles.