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 }

Read more here: Plugin options not being saved or created


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , ,

Wordpress related questions and answers: