0

I am trying to create a theme options menu item for my custom theme. However, when I add the following piece of code in the functions.php file...

add_menu_page('Page title', 'Asteria', 'manage_options', 'ThemeOptions', 'my_magic_function');

It gives me the following error when clicking on the menu item...

You do not have sufficient permissions to access this page.

The entire folder, and all contents are 777'd. I am logged in as an administrator. I have tried this on 2 different servers. One of the servers is running a network of blogs (the preferred server), the other is just a single blog setup.

Any ideas on where I went wrong?

4
  • 1
    Can it be something in the my_magic_function function? Your code works for me if I hook it to the right action (admin_menu). Dec 23, 2011 at 22:52
  • 1
    Any chance you can post the my_magic_function code and the action it's hooked to? Dec 24, 2011 at 6:38
  • You need to add that page inside a callback on admin_menu as is shown in the example on the codex page.
    – t31os
    Dec 24, 2011 at 11:39
  • Ah-ha, I must have skipped over this. Thanks!
    – Josh Dura
    Dec 24, 2011 at 14:46

1 Answer 1

0

Theme Options should use the edit_theme_options permission, not the manage_options permission. The former is the permission intended for editing Theme options; the latter is the permission intended for editing site options.

1
  • Perfect! It ended up being a combination of using the admin_menu hook (I was just calling a random action before) and the edit_theme_options permission. Thanks a ton for the help!
    – Josh Dura
    Dec 24, 2011 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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