How to Solve “You do not have sufficient permissions to access this page” WordPress Error Message
Last night, I updated a client’s site from WordPress 2.8 to the current WordPress 3.1.1. The 2.x to 3.x update is a major one and I was expecting to hit some stumbling blocks, especially with the custom plugins written by their previous developer.
As expected, the custom plugins’ settings pages yielded the dreaded blank screen with the “You do not have sufficient permissions to access this page” error message. The error occurs because it is looking for a page that doesn’t actually exist.
…/wp-admin/options-general.php?page=reallycoolplugin instead of
…/wp-admin/options-general.php?page=really cool plugin.
WordPress 3 strips out the spaces in the plugin slug name, hence resulting in the broken URL.
Thankfully, solving it is easy enough. If you encounter the same issue, this may fix it.
- Edit the problematic plugin file on a text editor. Look for the add_options_page function. It would look something like this:
add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my unique identifier', 'my_plugin_options');
- Rename the menu slug, “my unique identifier” in this case, so that it does not have spaces in it. For example:
add_options_page('My Plugin Options', 'My Plugin', 'manage_options', 'my-unique-identifier', 'my_plugin_options');
There are many possible causes for the “You do not have sufficient permissions to access this page” error message and this is just one example. If you have encountered the same error and managed to solve it in a different way, leave a comment here to share with us.