You can use the acf_update_value
filter to set a post meta value whenever the field is updated.
Here’s an example for a field named test_field
. Check if the current field is test_field
, then get its old value and compare it to the new value. If it has been updated, update a post meta field named _update_time
with the current time. In your template, use get_post_meta
to output the time.
function wpa85599_acf_update_value( $value, $field, $post_id ){
$old_val = get_field( 'test_field', $post_id );
if( $old_val != $value )
update_post_meta( $post_id, '_update_time', time() );
return $value;
}
add_filter( 'acf_update_value-test_field', 'wpa85599_acf_update_value', 10, 3 );
Have a look through the ACF documentation for other filters and actions. There are also more general filters that run on all fields or just certain field types, as welll as this filter which is specific to a single field name.
EDIT-
I just noticed you said options page, not a post. To make this work with the options page, just change update_post_meta
to instead update an option:
update_option( 'update_time', time() );