500

professional dilettante

wordpress theme options error – You do not have sufficient permissions to access this page

If you’re developing an Admin interface for your WordPress Theme or Plugin, and you get this error: You do not have sufficient permissions to access this page It has always been my experience that this error is thrown because the paths in your theme or plugin’s URLs are off. Maybe you are hacking someone’s plugin [...]

If you’re developing an Admin interface for your WordPress Theme or Plugin, and you get this error:

You do not have sufficient permissions to access this page

It has always been my experience that this error is thrown because the paths in your theme or plugin’s URLs are off. Maybe you are hacking someone’s plugin and you’ve renamed the plugin directory so as to avoid any confusion between your modified plugin and the original. Perhaps the original developer’s plugin code has hardcoded the plugin directory name/path, and thus your directory name differs. Often the code is trying to access a page in a directory that does not exist, eg:

/wp-admin?page=old-plugin-name/options.php

If you’ve renamed the original plugin, this will cause that awesome error, and you’ll see a page with nothing except the error. I usually end up tracking down all the hardcoded references using Aquamac’s awesome “rgrep” feature, or just grep from terminal.

Trying to think of a reason why it would be bad to use a constant or variable like:

$plugin_directory = array_shift( explode( "/" , plugin_basename(__FILE__) ) );

Leave a Reply

Required fields are marked with an asterisk (*), you may use these tags in your comment: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

 

Spam protection by WP Captcha-Free

Most Recent Post

create a file from content on your clipboard

You’re on github or something, reading code. You need to add some code to your project. You could: curl or wget the file URL clone the repo, extract single file, move it on file system create the file, open an editor, and paste in the content save as Here’s a terminal command I like. From [...]

Categories

Content © professional dilettante
Proudly powered by WordPress
Theme designed by Artisan Themes

Entries (RSS)
Comments (RSS)

25 queries.
1.856 seconds.