Support

Account

Home Forums ACF PRO ACF_Form – Default taxonomy via 'tax_input' without increasing permissions Reply To: ACF_Form – Default taxonomy via 'tax_input' without increasing permissions

  • Ok, I’ve figured out the author bit, because I needed to use the ID. I’m still stuck on the taxonomy

    
    $options = array(
    	'post_id'			=> 'new_post',
    	'post_title'			=> true,
    	'new_post'			=> array(
    		'post_type'		=> 'my-cpt',
    		'post_status'		=> 'publish',
    		'post_author'		=> $user_id  // Where $user_id is a number
    		'tax_input'		=> array('my_taxonomy' => $taxo_id), // Not working
    	),
    	'field_groups'			=> array(
    		1234
    	),
    	'submit_value' 			=> __("Add CPT", 'acf'),
    	'updated_message' 		=> __("CPT Added", 'acf'),
    	'uploader'			=> 'wp'
    );
    acf_form($options);
    

    Regarding the taxonomy, I’ve read this thread:

    acf_form, new_post, tax_input requires to be logged in

    – and –

    Using ‘tax_input’ with wp_insert_post() and nothing happens

    …so it seems that the user needs permission to assign taxonomies – OR – I need to use wp_set_object_terms() using acf/save_post. I’ve increased permissions, which appears to have worked, but I am curious if there’s a way to do this via wp_set_object_terms() so I don’t have to increase permissions.

    Does anyone have any ideas?

    Thanks in advance!