Support

Account

Home Forums ACF PRO Front edit form – Load taxonomye value Reply To: Front edit form – Load taxonomye value

  • Hi JacquesMivi,

    There is an option on the Taxonomy field type to “Load Terms” from the associated Post. You might try enabling that option for the field and setting the Taxonomy type in the “Taxonomy to display” filter to espresso_event_categories.

    If you need to change the “Taxonomy to display” on the fly, this code should help you:

    
    add_filter( 'acf/load_field/key=field_54dfccb977a11', 'tsm_load_post_category_field' );
    function tsm_load_post_category_field($field) {
    // Make sure to edit the $field object too, or AJAX lookups may return the wrong Taxonomy!
    $field['taxonomy'] = 'espresso_event_categories';
    return $field;
    }
    
    add_filter( 'acf/load_value/key=field_54dfccb977a11', 'tsm_load_post_category', 10, 3 );
    function tsm_load_post_category( $value, $post_id, $field) {
    	// get terms
    	$term_ids = wp_get_object_terms($post_id, array('espresso_event_categories'), array('fields' => 'ids', 'orderby' => 'none'));
    	
    	// error
    	if( is_wp_error($term_ids) ) {
    		return false;
    	}
    	
    	// return
    	return $term_ids;
    }
    

    ——————————–

    Help your fellow forum-goers and moderation team; if a response solves your problem, please mark it as the solution. Thank you!