WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Having a lot of trouble with this config page. I have followed the documentation (which was sparse) and done a bit of searching for help.

My problem is simple, my config options aren't being created or saved. Any help would be much appreciated!

Here's the general set-up:

    public $view;

    function __construct()
        $this->view = new My_View;
        // hook the settings menu
        add_action('admin_menu', array($this, 'index'));
        // hook the settings' settings
        add_action('admin_init', array($this, 'registerSettings'));
     * setup the settings menu Page Title, Menu Title, Permissions, Menu Slug, View to render
    public function index()
        add_options_page("My Settings", "My menu", "manage_options", "My_Settings", array($this->view, 'index_view'));

    public function registerSettings()
        //options, name of option, validate function
        register_setting('my_general_settings', 'my_general_settings');

next, the form:

public function index_view()
{ ?>

    <div class="wrap" style="display:block;">

        <form method="POST" action="">
            <h3>General Settings</h3>

            <?php settings_fields('my_general_settings'); ?>
            <?php $settings = get_option('my_general_settings') ?>

            <label for="my_settings[publisher_id]">Enter your Publisher ID:</label>
            <input type="text" name="my_general_settings[publisher_id]" value="<?php echo $settings['publisher_id']?>" />
            <input type="submit" value="Save Changes" />
            <p>Forgot your ID? <a href="">Click here</a></p>
<?php }
share|improve this question

The form action needs to point to options.php, which is WordPress' built-in handler for all settings pages:

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

This is documented fairly thoroughly on the Settings API page of the Codex.

share|improve this answer

Your Answer


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.