WordPress.org

Ready to get started?Download WordPress

Forums

Theme Options Page generates "insufficient permissions" for administrator (3 posts)

  1. burlesona
    Member
    Posted 4 years ago #

    So, I've created a basic theme-options panel for a CMS site that I'm working on. The admin panel controls the look and feel of the "featured" area on the home page, and it's all pretty simple stuff.

    This worked fine for several days, and then I'm suddenly getting this error message...

    You do not have sufficient permissions to access this page.

    ...whenever I press "save changes" on the options page. The url that is generated for this page is:

    .../wp-admin/themes.php?page=functions.php&saved=true

    This is occuring when I'm logged in as an administrator... More unusual still, is that the changes I made in the options panel actually do get saved to the database.

    So, basically the error message is completely inaccurate.

    I checked the required capabilities for the options page, the page is set like so:

    add_theme_page($themename." Settings", "".$themename." Settings", 'edit_pages', basename(__FILE__), 'mytheme_admin');

    So, this page should work for both Administrators and Editors.

    Again, the page was working fine and not displaying an error, and the only thing I can think of that might have changed this is I added a second administrator account. Now both administrator accounts get the same error message. I tried demoting the other admin to an "editor" and the problem remains.

    I'm kind of out of ideas here. Does anyone have any suggestions or feedback?

    Thanks!

    Now, the only thing I can think of that changed from when this page was working correctly.

  2. Jack Reichert
    Member
    Posted 4 years ago #

  3. burlesona
    Member
    Posted 4 years ago #

    Very interesting.

    For the benefit of the community, it turns out the problem comes from including a theme options page stored in any file other than "functions.php"

    I had my theme options code in a file called "theme_options.php" and included it in functions.php by using: require_once "theme_options.php"

    When I moved the code back into the functions.php file it worked fine.

Topic Closed

This topic has been closed to new replies.

About this Topic