WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I created an option panel following a tutorial.

But each time I try to save the settings I get the following:

You do not have sufficient permissions to access this page.

Any suggestions to fix this?

(Not sure if this helps but I'm using Wordpress 3.1.2)


I don't have the permission issue if I place the code directly in the functions.php file in my theme folder.

I have the file in functions/custom-functions.php. I have to change the 'header Location,' not sure how:

function mytheme_add_admin() {
    global $themename, $shortname, $options;

    if ( $_GET['page'] == basename(__FILE__) ) {
        if ( 'save' == $_REQUEST['action'] ) {
            foreach ($options as $value)
                update_option( $value['id'], $_REQUEST[ $value['id'] ] );

            foreach ($options as $value) {
                if( isset( $_REQUEST[ $value['id'] ] ) )
                    update_option( $value['id'], $_REQUEST[ $value['id'] ]  );
                    delete_option( $value['id'] );
            header("Location: admin.php?page=functions.php&saved=true");
        else if ( 'reset' == $_REQUEST['action'] ) {
            foreach ($options as $value)
                delete_option( $value['id'] );

            header("Location: admin.php?page=functions.php&reset=true");
    add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'mytheme_admin');
share|improve this question
up vote 1 down vote accepted

You're adding the menu page using the "administrator" role. Is the account you're using an administrator?


1) You should be using an appropriate capability, rather than a user role. Generally, the appropriate capability for editing Theme options is edit_theme_options.

2) There is a known bug with WordPress, in that currently, manage_options is required for the form submit on options.php, which is used by Theme settings pages. This is only an issue for user roles below editor, and will hopefully be fixed in 3.2 or 3.3.

3) If this is a public Theme, you should be using add_theme_page() (which adds a submenu to the "Appearance" menu), rather than add_menu_page() (which adds a top-level menu page).

4) That tutorial is considerably out of date.

share|improve this answer
Thanks for helping again. Can you give me an example for 1)? How would that code look like (Which lines I have to replace)? – janoChen May 9 '11 at 2:16
@janoChen: the third argument in add_menupage() currently is 'administrator'; change it to 'edit_theme_options'. – Chip Bennett May 9 '11 at 12:03

You need to make two changes in your code...

  1. Change the third argument of add_menu_page from "administrator" to "edit_theme_options".
  2. Chage header("Location:") code line to...

header("Location: admin.php?page=" . basename(__FILE__) . "&saved=true");

Please make similar change for Reset.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.