For some reason my select field is not saving the value when I display the options this way,
'options' => array(
array( 'value' => 'value1', 'label' => 'Label1' ),
array( 'value' => 'value2', 'label' => 'Label2' ),
array( 'value' => 'value3', 'label' => 'Label3' ),
And it is working fine when options are displayed this way
'options' => array(
'value1' => 'label1',
'value1' => 'label1',
'value1' => 'label1',
),
The problem is that I want to list the terms of a Taxonomy associated with another custom post type and I don't seems to be able to display the list of term and save the selected value using the 2 way of displaying the options.
Here is the actual code I use:
$optionsaddressloop = array();
$terms = get_terms( array(
'taxonomy' => 'partner_address_firm',
'hide_empty' => false,
) );
foreach ($terms as $term) {
$optionsaddressloop[] = array(
'value' => $term->slug,
'label' => $term->slug,
);
}
$meta_boxes[] = array(
'id' => 'partner-admin-fields',
'title' => 'Partner Firm Admin Custom Fields',
'post_types' => 'partner',
'context' => 'normal',
'priority' => 'high',
'fields' => array(
array(
'name' => 'Term for Address Loop',
'id' => $prefix . 'firm_term_address_loop',
'type' => 'select_advanced',
'multiple' => false,
'placeholder' => '-- select --',
'options' => $optionsaddressloop,
),
)
);