Hook called over and over

[ad_1]

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()

  • This topic was modified 27 minutes ago by pzh20.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer