Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9105359
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:05:27+00:00 2026-06-17T02:05:27+00:00

I created a simple wordpress plugin today which is essentially an options page. It

  • 0

I created a simple wordpress plugin today which is essentially an options page. It is based on the instructions at this link: http://codex.wordpress.org/Creating_Options_Pages (there is example code at the bottom of that page which I used as the backbone for my plugin).

Basically, I want authors/contributors to be able to see a new tab in their admin menu, which when clicked, would take the user to a page where he/she can write some text and hit “save changes” (which would then save that text to a database). I want to later be able to call this text via something like get_option(‘some_option’).

However, authors/contributors cannot “manage_options” & this prevented them from editing the options on the new menu tab I created. I installed a plugin called “User Role Editor” to allow authors/contributors to manage_options, but this brings the “Settings” tab in their admin menu and allows them to manage all options.

How can I allow authors/contributors to only manage_options for the plugin I created and nothing else? Can I lift permission restrictions for the plugin I created? Any guidance would be appreciated! (The plugin development went smooth but now I’m stuck).

My code is pretty much analogous to the example found in the link given above:

<?php
add_action('admin_menu', 'baw_create_menu');

function baw_create_menu() {

    //create new top-level menu
    add_menu_page('BAW Plugin Settings', 'BAW Settings', 'edit_posts', 'my-plugin', 'baw_settings_page');

    //call register settings function
    add_action( 'admin_init', 'register_mysettings' ); }


function register_mysettings() {
//register our settings
register_setting( 'baw-settings-group', 'new_option_name' );
register_setting( 'baw-settings-group', 'some_other_option' );
register_setting( 'baw-settings-group', 'option_etc' ); }

function baw_settings_page() { ?> <div class="wrap"> <h2>Plugin Name</h2>

<form method="post" action="options.php">

    <?php settings_fields( 'baw-settings-group' ); ?>
    <?php do_settings( 'baw-settings-group' ); ?>

    <table class="form-table">

        <tr valign="top">
        <th scope="row">New Option Name</th>
        <td><input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" /></td>
        </tr>

        <tr valign="top">
        <th scope="row">Some Other Option</th>
        <td><input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" /></td>
        </tr>

        <tr valign="top">
        <th scope="row">Options, Etc.</th>
        <td><input type="text" name="option_etc" value="<?php echo get_option('option_etc'); ?>" /></td>
        </tr>

    </table>

    <?php submit_button(); ?>

</form> </div> <?php } ?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T02:05:28+00:00Added an answer on June 17, 2026 at 2:05 am

    I found the solution:

    function twentyeleven_option_page_capability( $capability ) {
        return 'edit_posts';
    }
    add_filter( 'option_page_capability_baw-settings-group', 'twentyeleven_option_page_capability' );
    

    I added that right after the function that registers settings (In the code I provided above, that would be the function register_mysettings())

    Basically, the add_filter function allows options of the group baw-settings-group (declared in the register_mysettings function by the register_setting function) to be altered by users who can edit_posts (the function twentyeleven_option_page_capability is given to add_filter as the second argument which returns ‘edit_posts’).

    Source: http://wordpress.org/support/topic/wordpress-settings-api-cheatin-uh-error?replies=0

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a simple WordPress plugin that automatically sets my new sites up
I am creating a plugin for Wordpress. I created a simple PHP file: Test.php.
I have created a simple WordPress page template. I am working on live server.
I've created a simple PHP test page which connects to a MySQL database, selects
i have made a simple php contact form following this tutorial: http://www.catswhocode.com/blog/how-to-create-a-built-in-contact-form-for-your-wordpress-theme The big
Hello I`ve created simple WFC DataService and connected entit model with my database. This
Could someone help me on this, I have created simple web services using axis2
I've created several helper functions which I use when creating templates for Wordpress. An
I have created a simple wp7 application which contains 2 pages both with a
I've been developing a pretty simple WordPress plugin, and wanted to do some live

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.