• Hi,
    hope fully someone can help as Im pulling my hair out with this one.

    I have added a custom admin page which works fine as an admin. I have set the capability to “read” so that any role can access it.
    When logged in as an anything other than an admin the new page can be seen but when trying to save changes it displays the infamous message “cheatin’ uh?”

    Please tell me where I am going wrong here…

    add_action( 'admin_menu', 'mytheme_options' );
    function mytheme_options() {
    	// Add theme options page to the addmin menu
    	add_menu_page( 'Site Options', 'Site options', 'read', 'theme_options', 'mytheme_home_page' );
    }

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Have you reviewed the Settings_API? Sounds like you have an issue with the nonce value.

    Thread Starter utcwebdesign

    (@utcwebdesign)

    Hi Esmi,

    thanks for your reply. I have had a look through the Settings_API and it all seems to be as it should. Is there something specific I need to be looking for?

    Is there any code I can show you that will verify that everything is correct.

    Thread Starter utcwebdesign

    (@utcwebdesign)

    Thanks for the link.

    The page has been set up and registered as per the tutorial but still the same happens. Any other ideas?

    Thanks again

    Moderator bcworkz

    (@bcworkz)

    The options page which processes option form POST requests requires manage_options capability regardless of what capability is specified to display the page. There’s no clean way to alter this behavior.

    In order to save options for lesser capability users, you need to abandon the Settings API and have your page manage the form POST request on it’s own.

    Thread Starter utcwebdesign

    (@utcwebdesign)

    Ahhhh, I see. Thanks I’ll have a play with that.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Capability not working for add_menu_page’ is closed to new replies.