update_option_{$option} Too Few Arguments

When you call add_action, you need to tell it how many parameters of the action that you want to receive. The default is just the first parameter. If you want more, then you tell it so.

add_action( 'update_option_whatever', 'example_callback', 10, 2 );

The 10 is the priority (10 is default).

The 2 is the number of parameters to send to your callback (1 is the default).

So if example_callback looks like this:

function example_callback( $old_value, $new_value )

Then you need that 10,2 on the add_action.

Leave a Comment