Support

Account

Home Forums ACF PRO ACF Form – form taxonomy check by default Reply To: ACF Form – form taxonomy check by default

  • Thank you , unfortunately it is still not functional

    add_action( 'genesis_entry_content', 'tsm_do_create_post_form' );
    function tsm_do_create_post_form() {
    	// Bail if not logged in or able to post
    	if ( ! ( is_user_logged_in()|| current_user_can('publish_posts') ) ) {
    		echo do_shortcode( '[wppb-login] ' );
    		return;
    	}
    	$new_post = array(
    		'post_id'            => 'new', // Create a new post
    		'field_groups'       => array('group_54dfc93792c38', 'group_56afa46678eb3', 'group_56afa46adc147', 'group_569a815405075', 'group_56ab8bb40edcc', 'group_56bdf6aa906e1'), // Create post field group ID(s)
    		'form'               => true,
    		'return'             => '%post_url%', // Redirect to new post url
    		'html_before_fields' => '',
    		'html_after_fields'  => '',
    		'submit_value'       => 'Poster',
    		'updated_message'    => 'Saved!'
    	);
    	acf_form( $new_post );
    	
    	// Catégorie
    	add_filter('acf/load_field/key=field_54dfccb977a11', 'vivi_load_post_category');
    }
    
    function vivi_load_post_category($field) {
      $field['default_value'] = array(72);
      return $field;
    }