Title: Bug on select fields
Last modified: August 21, 2016

---

# Bug on select fields

 *  Resolved [anija](https://wordpress.org/support/users/anija/)
 * (@anija)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/bug-on-select-fields/)
 * I’ve added a custom field of select type, but the values selected aren’t saved.
   
   So i found this line in funciotn meta_box_save():
 *     ```
       ${$f} = isset( $_POST[$f] ) && is_array( $field_data[$f]['options'] ) && in_array( $_POST[$f], $field_data[$f]['options'] ) ? $_POST[$f] : '';
       ```
   
 * I don’t think it’s correct, the value of the select it’s matched against texts.
   
   I’ve changed it into:
 *     ```
       $values = array();
       if (is_array( $field_data[$f]['options'] ))
           $values = array_keys($field_data[$f]['options']);
       ${$f} = isset( $_POST[$f] ) && in_array( $_POST[$f], $values ) ? $_POST[$f] : '';
       ```
   
 * Now everything works!
 * [https://wordpress.org/plugins/projects-by-woothemes/](https://wordpress.org/plugins/projects-by-woothemes/)

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

 *  Plugin Author [James Koster](https://wordpress.org/support/users/jameskoster/)
 * (@jameskoster)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/bug-on-select-fields/#post-4803264)
 * Thanks for reporting this, and for the proposed fix! We’ll look into this for
   the next release.
 *  Plugin Author [James Koster](https://wordpress.org/support/users/jameskoster/)
 * (@jameskoster)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/bug-on-select-fields/#post-4803340)
 * [Fixed](https://github.com/woothemes/projects/commit/3a575d7823e01ab569159e36fdd60068d655cf29)
   for 2.1 :-).
 *  Thread Starter [anija](https://wordpress.org/support/users/anija/)
 * (@anija)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/bug-on-select-fields/#post-4803341)
 * Great job! Thank you 🙂

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

The topic ‘Bug on select fields’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/projects-by-woothemes_d2e5ef.svg)
 * [Projects by WooThemes](https://wordpress.org/plugins/projects-by-woothemes/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/projects-by-woothemes/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/projects-by-woothemes/)
 * [Active Topics](https://wordpress.org/support/plugin/projects-by-woothemes/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/projects-by-woothemes/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/projects-by-woothemes/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [anija](https://wordpress.org/support/users/anija/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/bug-on-select-fields/#post-4803341)
 * Status: resolved