Title: Get custom field value list
Last modified: July 4, 2017

---

# Get custom field value list

 *  Resolved [gleenk](https://wordpress.org/support/users/gleenk/)
 * (@gleenk)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get-custom-field-value-list/)
 * Hi, i need a quick example on how to get current post custom field. I have a 
   custom field array but when i create my filter i always get key value (1,2,3)
   instead of array value:
 *     ```
       function cf7_dynamic_select_do_example1($choices, $args=array()) {
           $choices = get_field('prod_esecuzione');
           return $choices;
       } 
       add_filter('fi-dyn-esecuzione', 'cf7_dynamic_select_do_example1', 10, 2);
       ```
   
 * I always get 0,1,2,3 instead of value

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Plugin Author [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get-custom-field-value-list/#post-9287814)
 * What type of ACF field are you using there and what do you have the return set
   to?
 * My guess is that it is returning an array of `value => label` pairs and this 
   plugin requires them as `label => value` pairs. (The reason that I’ve done this
   is to allow multiple labels to have the same value.)
 * I would try
 *     ```
       $choices = array_flip(get_field('prod_esecuzione'));
       ```
   
 *  Thread Starter [gleenk](https://wordpress.org/support/users/gleenk/)
 * (@gleenk)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get-custom-field-value-list/#post-9289846)
 * I’m using a checkbox field! And your trick works! 🙂
 * PS: is it possible to have a blank value as first one?
    -  This reply was modified 9 years, 1 month ago by [gleenk](https://wordpress.org/support/users/gleenk/).
    -  This reply was modified 9 years, 1 month ago by [gleenk](https://wordpress.org/support/users/gleenk/).
 *  Plugin Author [John Huebner](https://wordpress.org/support/users/hube2/)
 * (@hube2)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/get-custom-field-value-list/#post-9290618)
 * Yes
 *     ```
       $choices = array('-- Make a Selection --' => '');
       $choices = array_merge($choices, array_flip(get_field('prod_esecuzione')));
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Get custom field value list’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/contact-form-7-dynamic-select-extension.
   svg)
 * [Dynamic Select for Contact Form 7](https://wordpress.org/plugins/contact-form-7-dynamic-select-extension/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/contact-form-7-dynamic-select-extension/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/contact-form-7-dynamic-select-extension/)
 * [Active Topics](https://wordpress.org/support/plugin/contact-form-7-dynamic-select-extension/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/contact-form-7-dynamic-select-extension/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/contact-form-7-dynamic-select-extension/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [John Huebner](https://wordpress.org/support/users/hube2/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/get-custom-field-value-list/#post-9290618)
 * Status: resolved