If you want to hook into WordPress when an options page is saved and access the values that were entered, you can use update_option_{$option}.

Let’s say for my options page, I added the setting like this:

register_setting( km_my_cool_options, km_my_cool_options );

I could then hook into when the options page is saved and access the old & new values like this:

1 comment

  1. Edward February 27, 2018 at 1:14 pm

    Reply

    Thank you for this tip! I spent hours yesterday trying to figure out how the $old_value variable works. The API does not have much on this hook.

Leave a reply

Your email address will not be published. Required fields are marked *