Need action hook when WordPress updates settings (3 posts)

  1. greenpeacock
    Posted 4 years ago #

    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.

  2. polo12
    Posted 3 years ago #

    I too need the hook when a plugin's options are saved. Somebody please help.

  3. polo12
    Posted 3 years ago #

    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');
    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

Topic Closed

This topic has been closed to new replies.

About this Topic