I'm currently developing a WordPress theme and would like it to have a preferences pane in order to specify the user's Google Analytics tracking code for example.

Following the instructions I got on the Codex and multiple tutorials, this piece of code placed in the functions.php file should create a submenu of the 'Appearence' section and display either "Theme preferences" if the user has the 'manage_options' capability, or "You shall not pass." if not.

// Add theme settings link in the admin section menu

function add_appearance_menu() {
    add_theme_page('Theme preferences', 'Theme pref.', 'manage-options', 'interact-theme-settings', 'render_theme_settings');

add_action('admin_menu', 'add_appearance_menu');

// Render theme settings page

function render_theme_settings() {
    if (!current_user_can('manage_options')) {
    wp_die(__('You shall not pass.'));
    echo "Theme preferences";

However, nothing new appears in my admin menu and when I try to access the page manually (http://mydomain.com/wp-admin/themes.php?page=interact-theme-settings), it displays this error message:

You do not have sufficient permissions to access this page.

...which in any way is not the "You shall not pass" message that I specified in my render-theme_settings() function.

Can someone please explain me what's wrong with my code? Thanks in advance for your help :)

EDIT: I would like to point out that -of course- the user I'm testing all this with HAS the 'manage_options' capability.

1 Answer 1


manage-options should be manage_options. Try this:

 add_theme_page('Theme preferences', 'Theme pref.', 'manage_options', 'interact-theme-settings', 'render_theme_settings');
  • Ooooh gosh... I can be so dumb sometimes. Thanks a lot for your answer!
    – Drav'
    Dec 25, 2014 at 0:43

Your Answer

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

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