If you’ve recently adjusted the Roles & Permissions settings for the WP Statistics plugin and now find that certain menus are missing or you encounter the error message “You do not have sufficient permissions to access this page“, here’s how you can troubleshoot and resolve this issue.
Why This Happens
WP Statistics allows you to assign specific roles and capabilities for accessing its features. If these settings are configured incorrectly, you might lose access to the plugin’s menus and pages, even as an administrator. Fortunately, there are a couple of ways to fix this issue.
Solution 1: Using WP-CLI
If you have access to WP-CLI, you can easily check and reset the permissions for WP Statistics.
Check Current Capabilities
Run the following command to see what roles are currently set:
wp option get wp_statistics | grep "_capability"
This will show the capabilities required for viewing and managing the plugin.
Reset Capabilities
If the capabilities are not set to a sufficient level, you can reset them with:
wp option patch update wp_statistics read_capability manage_options
wp option patch update wp_statistics manage_capability manage_options
The read_capability
controls which roles can view the WP Statistics dashboard.
The manage_capability
controls which roles can change the plugin’s settings.
Setting both to manage_options
ensures administrators have full access.
Solution 2: Manual Update via Database
If WP-CLI is not available, you can adjust the settings directly in your database.
Access the WordPress Database
- Log in to your hosting control panel and open phpMyAdmin (or use a similar tool).
- Select your WordPress database.
Locate and Edit the wp_statistics Option
- Go to the wp_options table.
- Find the row where option_name is wp_statistics.
- Edit its value by locating:
"read_capability";XXXXXXXXX;
"manage_capability";YYYYYYYYY;
- Replace
XXXXXXXXX
; with “manage_options
“;
- Replace
YYYYYYYYY
; with “manage_options
“;
The final value should look like this:
s:15:"read_capability";s:14:"manage_options";s:17:"manage_capability";s:14:"manage_options";
Warning: Be extremely cautious when editing serialized data. Even a minor mistake (like a missing character) can cause your site to encounter errors.
By following these methods, you should be able to restore full access to the WP Statistics plugin. Always ensure you have a backup of your database before making any changes, especially when editing settings directly in the database.
If you continue to experience issues, please visit the WP Statistics Support for further assistance.