Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
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). –  Rob Vermeer Dec 23 '11 at 22:52
1  
Any chance you can post the my_magic_function code and the action it's hooked to? –  brandwaffle Dec 24 '11 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 '11 at 11:39
    
Ah-ha, I must have skipped over this. Thanks! –  Josh Dura Dec 24 '11 at 14:46

1 Answer 1

up vote 0 down vote accepted

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.

share|improve this answer
    
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 '11 at 14:45

Your Answer

 
discard

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.