I am using the Settings API for a plugin’s settings page. One of the settings allows the user to change the cron job interval for the cron job created by this plugin.
Therefore I’d like to run a function on saving of the settings page, which checks the value in the database and compares it to the value the existing cron job has. If they are different, the cron job should be recreated.
Is my logic right, and if so how can I run such a function after the plugin settings have been saved?
I’m not familiar with wordpress settings api but I know those options generated by settings api are handled/saved in wp-admin/options.php
Unfortunately,
as you can see, no hook before update_option.
But there is a workaround:
Not very elegant though.
The correct answer is to add_action after an option as been updated.
See this answer: Hook if somebody saves plugin options?