Trying to check if a field is updated and if it is perform a function but can’t get it to work. Here is my code:
function smsemail_update( $post_id ) {
$user_new=$_POST['user_new'];
$user_saved=get_field('user_new', $post_id);
if ($user_saved==$user_new){
}
else {
MY FUNCTION...
}
}
add_action( 'acf/pre_save_post', 'smsemail_update' );
Any ideas?
Hi @almemedia
The acf/pre_save_post
is a FILTER which is only run from the front end form. This allows the $post_id variable to be modified.
Perhaps you would be better off attaching your custom code to a filter on the acf/update_value
. Please read the docs for this filter to see how you can use it.
Thanks
E