Hook called over and over
-
I have the following hook that should be call when my form is submitted, but I’ts called even when I’m not doing anything associated with it. Is this a wordpress issue or something wrong with my code?
acf_log('Inside FAM - Complete Family Member Title and date fields (acf extended form)');
add_action('acfe/form/submit_post/form=add_family_member', 'my_post_submit', 10, 4);
function after_save_post( $form, $post_id ){
$firstname = get_field('first_name',$post_id);
$middlenames = get_field('middle_names',$post_id);
$lastname = get_field('surname',$post_id);
$dob = date("d/m/Y", strtotime(get_field('date_of_birth',$post_id)));
$dod = date("d/m/Y", strtotime(get_field('date_of_death',$post_id)));
if($dod) {
$dod = '> ' .get_field('date_of_death',$post_id);
} else {
$dod = null;
}
$post_title = implode(' ',array_filter([$firstname,$middlenames,$lastname,'-',$dob,$dod])) ;
acf_log('Inside FAM - ' . $post_title);
}Sorry, I forgot to say that I never get log entries for anything other than the first call to acf_log()
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Hook called over and over’ is closed to new replies.