Home Forums Front-end Issues Adding a post from the frontend


Adding a post from the frontend

  • Hi.
    how should I assign a post from user frontend from acf relations field to a custom category


    acf_form and tax_input or add_action acf/save_post ?

  • That depends the value you want to store.

    If the post can only have one term in the custom taxonomy, or you want to overwrite any terms already assigned to the post, the you can use an ACF taxonomy field.

    On the other hand, if you want to append the term to the other terms already assigned to the post the you need to use acf/save_post and call wp_set_post_terms() with $append set to true.

  • Ok. thanks.

    I have custom_field offer_category – this field isto be taxonomy

    I have page add-post.php with acf_form_head();
    and I have the code below:

    <?php acf_form(array(
    	'post_id'  => 'new_post',
    	'uploader' => 'basic',
    	'return'  => '%post_url%',
    	'updated_message'  => 'Post saved!',					
    	'new_post' => array(
    		'post_type' => 'offer',
    		'tax_input' => array('typ' => array($_POST['acf']['field_ID_RELATION_TAX_FIELD'])),	
    		'post_status'		=> 'draft',						
    	'submit_value'		=> 'Add'
    )); ?>

    and whole post is being saved but is not affiliated with my custom taxonomy

  • Hey, no one will advise ??? 🙂
    where do I make mistake ?

  • … i found error…

    everything works on standard acf_form()

    I didn’t select button save taxonomy terms….

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

The topic ‘Adding a post from the frontend’ is closed to new replies.