Home Forums General Issues on save_post send email, taxonomy field issue


on save_post send email, taxonomy field issue

  • I am using acf/save_post hook to send an email when the post is submitted. All fields are being sent properly with the exception of the taxonomy field(select appearance)When saving the post the field will be empty in the body of the sent email.

    function my_acf_save_post( $post_id ) {

    //doesn’t work for taxonomy
    $term_manufacturer = get_field(‘manufacturer’, $post_id);
    if( $term_manufacturer ):
    $body_manufacturer = $term_manufacturer->name;
    //works for the following fields: text, textarea, radio button, gallery(image url), select
    if(get_field(‘model’, $post_id)){
    $body_model = get_field(‘model’, $post_id);

    add_action(‘acf/save_post’, ‘my_acf_save_post’, 15);

    Can’t see what’s not working for the Taxonomy field. Thanks!

  • Hi @manu_baje

    This is likely because different field types will return different data types from the get_field() API call.
    Please debug the output to check the returned data:

  • Thanks,

    The post was saved correctly, so I end up saving the post first, and then send the email, instead of save the post and send email at the same time. This way I got the correct values in the email.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘on save_post send email, taxonomy field issue’ is closed to new replies.