Support

Account

Home Forums Front-end Issues Populate Taxonomy ID dynamically Reply To: Populate Taxonomy ID dynamically

  • If the data isn’t sent from the form, you can dump out the post value before your code and see what’s the actual key is. (maybe there’s a typo in your field key)

    
    echo '<pre>';
    print_r($_POST['acf']);
    echo '</pre>';
    

    Another reason might be, the form is sending the value as a string, but the wp functions requires a pure integer. See last example in the doc, https://codex.wordpress.org/Function_Reference/wp_set_post_terms

    So, your code might even need to cast the value with intval first.

    
    'custom_tax_tag => array( intval($_POST['acf']['field_5a903d3132d04']) )
    

    Cheers