Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

This error is really well known and every where I look its either I am not doing:

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

or I am not registering my options, which is not the case as seen in the following class:

class CoreTheme_AdminPanel_Admin implements AisisCore_Interfaces_Admin{

    public function __construct(){
        add_action('admin_menu', array($this, 'menu_setup'));
        add_action('admin_init', array($this, 'register_settings'));

        add_option('success_message', false);
    }

    public function init(){}

    public function menu_setup(){
        add_menu_page(
            __('Aisis', 'aisis'), 
            __('Aisis', 'aisis'), 
            'edit_themes', 
            'aisis-core-options', 
            array(
                $this, 
                'build_template'),  
                get_template_directory_uri() . '/images/block.png', 
                31
            );

        add_submenu_page(
            'aisis-core-options', 
            __('Aisis BBPress Options', 'aisis'), 
            __('Aisis BBpress Options', 'aisis'), 
            'edit_themes', 
            'aisis-core-bbpress', 
            array(
                $this, 
                'build_template'
            )
        );

        add_submenu_page(
            'aisis-core-options', 
            __('Aisis Packages', 'aisis'), 
            __('Aisis Packages', 'aisis'), 
            'edit_themes', 
            'aisis-core-packages', 
            array(
                $this, 
                'build_template'
            )
        );

        add_submenu_page(
            'aisis-core-options', 
            __('Aisis Update', 'aisis'), 
            __('Aisis Update', 'aisis'), 
            'edit_themes', 
            'aisis-core-update', 
            array(
                $this, 
                'build_template'
            )
        );
    }

    public function register_settings(){
        register_setting(
            'aisis_options', 
            'aisis_sitedesign', 
            array(
                $this, 
                'option_validator'
            )
        );
    }

    public function build_template(){
        $template = AisisCore_Factory_Pattern::create('CoreTheme_Templates_Builder');
        $template->render_template(CORETHEME_ADMIN_TEMPLATES . 'coretheme.phtml');
    }

    public function option_validator($input){
        $option = get_option('aisis_core');
        $option = $input;
        update_option('success_message', true);
        return $option;
    }
}

so why am I getting this error?, my settings are registered, the form renders, everything seems to be fine....

share|improve this question
add comment

1 Answer

The action attribute in the form tag redirects you to the options page. But you also need a hidden field with the plugin slug. Normally its a hidden field that looks like this <input type="hidden" value="/wp-admin/options.php?page=[plugin-slug]" name="_wp_http_referer"> where [plugin-slug] is replaced by your plugin slug.

share|improve this answer
add comment

Your Answer

 
discard

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.