Hi there
I’m trying to populate a select-dropdown with values from an acf text field. My code is this:
function dyr_value() {
$field_key = "field_5698caa683247";
$field = get_field_object($field_key);
$dyr = get_field('dyr');
if ($field) return $field['choices'][ $dyr ];
}
But the result is null, nothing, nada … :/
I have adopted the if ($field) from another function where I fetch data from an acf select field; that works…
What I’m doing wrong ?
Cheers,
Adam
I have moved away from that ‘solution’ and doing this one right now:
function key_value_select( $key ) {
global $wpdb;
$args = array( 'post_type' => 'post' , 'post_status' => 'publish' , 'post_per_page' => -1);
$getposts = get_posts( $args );
foreach($getposts as $post) : setup_postdata($post);
$themeta = get_post_meta($post->ID, $key ,true);
$meta_value = $themeta;
$meta_value .= ' => ';
$meta_value .= $themeta;
$meta_value .= ' , ';
endforeach;
return $meta_value;
}
and in conjuction with the WP Advanced Search framework I get PHP warning >> PHP Warning: array_reverse() expects parameter 1 to be array, string given in …
I have asked at wpas’ support @ github.
Cheers,
Adam