I am working on a plugin and I want to fire a different action based on each option value change. so how can I do that ?
example:
$options = get_option(‘ACP_settings’);
if $options[‘acp-select’] has changed from previous value than I want to fire different action based on selection
please note that $option[‘acp-select’] is retrieved from select/option html form and has following values for selection:’book’,’air’,’SW’,’HW’ etc….
I hope I have posted my question clearly.
thanks for help
I just came across your question while trying to do a similar thing. I figured out what I needed so I thought I would post an answer here in case someone else finds it useful.
In short I used this filter: https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_update_option_(option_name)
And it looks something like this:
With this method you will then have an option saved if a change is found. Then you can check that option anywhere else and perform any action with it and remove the option afterwards or whatever you wish to do.
Hope you find this helpful.