Use the action update_option_{$option}, where $option is the same as the second argument for register_setting(). This hook fires after the option has been updated.
add_filter( 'update_option_directory', 'run_after_change', 10, 2 );
function run_after_change( $old_value, $new_value )
{
// compare both values and do something
}
10 is the priority, 2 the number of accepted arguments for the callback function.
The opposite is pre_update_option_$option, which runs before the option is updated. It sends the same two parameters.
Related Posts:
- Uncaught Error: Call to undefined function wp_generate_attachment_metadata() @ wp-cron
- Schedule WordPress Auto-Updates to only run during business hours
- What happens when wp_cron is deactivated in WordPress?
- Updating WooCommerce variable product stock issue
- wp_schedule_event / cron_schedules – custom recurrence time not working in Plugin
- wp_schedule_single_event function not working
- How ( and mostly at what time ) can i prevent the alternate cron from running?
- Why is wp-cron only executing on page visit?
- Certain actions failing when run through cron
- Does using WP-cron make the site slower for the user?
- wp_schedule_single_event not working: cron job is triggered but nothing gets executed
- How does task scheduler plugin implements cron that is not dependent on page load request? [closed]
- How to set intervals in cron jobs?
- WordPress Console Application (ability to excecute a custom function via crontab only)
- Plugin scheduled event not working
- Switch from wp-cron to a server cron job
- I’m looking for a plugin to execute a specific task a certain time
- What causes wp_schedule_single_event to fire off?
- How can i find the cron jobs that run on my site and then move them to the server side?
- WordPress cron job running more than once
- WP Import All Multiple Dynamic Link Imports
- Cron: Update four post at Hour
- Activate Plugin Automatically After Set Time
- Cron task gets removed from the schedule
- my hook or my function wont run in the cronjob
- Cron job shedules replace?
- WP_CRON issue with UTC and local time
- Run a Change Role Cron Job on WordPress via cPanel
- Better way to run heavy scripts using WordPress database
- Cron job emails blank
- WordPress Cron function is not working
- WordPress crob job performance
- Adding custom cron_schedule prior to wp_schedule_event
- How to set-up multiple cron task with wp_schedule_event so that they do not overlap?
- WordPress “wp cron event run” as Siteground cron job
- Cron Job not working
- Long running tasks in a plugin: wp-cron vs REST API callback [closed]
- Which approach for managing automatic updates would be more robust?
- Add Google Analytics manually, or use a plug-in?
- Custom pages with plugin
- How to catch/what to do with a WP Error Object
- How can I see all the actions attached to an “add_action” hook?
- Echo simple string in Plugin
- Can we completely remove the WordPress Sitemaps (WordPress 5.5)?
- WordPress pods io – Rest API for fetching fields information for custom post type
- How can I show drafts in wp_dropdown_pages list?
- Missing argument 2 for wpdb::prepare() Issue
- Can Not Redirect from Plugin-Registered Admin Page
- Why does my hand-written plugin installer fail to find `request_filesystem_credentials`?
- How to Reload the Dashboard After Clicking Update in Quick-Edit?
- How to make a WP admin button/menu similar to Jetpack Notifications?
- How to upload thousands of images?
- I need to generate the CSS for my plugin from a function, how do i map a request to a function in the front-end?
- Using ACF to display data on all pages
- How to remove the woocommerce_checkout_process action hook in woocommerce if particular project in cart [closed]
- WordPress Automatic Plugin Update Renames Plugin Directory
- Create a list-style post of popular posts for the week?
- Can’t delete Draft Post [closed]
- Looking for a way that will collect visitors emails before letting them view the blog posts [closed]
- How can I inject options into an select tag inside the widget form?
- WordPress user account activation
- Init plugin again after ajax call finish
- Integrate Facebook comments with native comments
- Redirect to another page using contact form 7? [closed]
- Batch update of WordPress Plugins
- Separate database for a wordpress plugin
- Specific way to allow WordPress users to view their current password? And edit it?
- Is there a function to list all uploaded images? How can I add one?
- How use wp media upload liberary in react components?
- Passing Parameters from shortcode to enqueue script
- site url is not working after migrtaion in worpress, all links are broken
- If I use an alternative login (e.g. CAS or other SSO) plugin, is my site protected from the recent brute force login attempts?
- How to deactivate my plugin upon deactivation of NextGen
- Problems with jQuery and is_admin()
- Simple sildeshow/image-upload plugin?
- How to hide particular plain text with link from different subscribers
- Manualy Updated WordPress Error
- Can I add Short Code Of A Plugin In The Code Editor of WordPress?
- Custom Plugin: How to Include Install Buttons of other 3rd Party Plugins?
- Simulate Update User button click
- Disable plugin for administrator
- Modify Plugin PHP Class in Child Theme – Correct Method
- WordPress wp-admin redirects to home page
- Customize a widget position
- Admin Logged In Notify Globaly
- Editing Global Variables from Inside Functions
- building custom simple shopping cart using wordpress plugin
- Posting code inside the post instead of in the template file using shortcode
- overwrite a plugin function in functions.php
- How to list the categories by custom taxonomy created?
- Allow users to enter and edit data in one-to-many configuration
- How to make is_admin() return false when I need it to?
- Facebook comment into my blog
- Distribute post content through several divs [closed]
- Does anyone have the Custom Post Permalinks plugin from John P. Bloch? [closed]
- contact form 7 captcha support anyother captcha plugin? [closed]
- How can I utilize the same “show more” functionality that I see in superuser on my own WordPress site?
- WDTException: [0]: One or more columns doesn’t have a header
- List Hidden Plugins
- How do I apply different block supports to different parts of my custom block?