• Hey guys,

    Can someone please help? I need the action hook name when WordPress updates settings. On your plugin’s options page when the user clicks the submit button to save options, WordPress actually handles updating settings for the developer (instead of the developer manually using the update_option function to update settings).

    Example: When the user clicks on the submit button, I want to print a feedback message like “Settings saved” at the top of my plugin’s options page.

    Please help. Unfortunately, I couldn’t find this hook in Codex. I would really appreciate your help. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I too need the hook when a plugin’s options are saved. Somebody please help.

    So far I didn’t find a hook for the above. But my job was done by checking the URL in my plugin’s option page.
    Whenever the plugin’s settings are successfully updated , the URL is appended by settings-updated=true. So I put the following code in my plugin’s admin file.

    $hook = add_menu_page('My Plugin Settings','My Plugin Settings','manage_options','my_plugin_settings','display_plugin_options');
    add_action('load-'.$hook,'do_on_my_plugin_settings_save');
    
    function do_on_my_plugin_settings_save()
    {
      if(isset($_GET['settings-updated']) && $_GET['settings-updated'])
       {
          //plugin settings have been saved. Here goes your code
       }
    }

    For information on the load-(page) hook, go here

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Need action hook when WordPress updates settings’ is closed to new replies.