Wordpress Meta Field - Finding the values of a select meta- field -


i have created custom field ( select box) post type - flavors. custom field type can have flavors vanilla, chocolate etc.. set @ run-time administrators.

i have requirement, need list values @ run time has been set custom field type choices.

how do this?

get_post_meta return value set particular post id.

if understand requirement right (and tbh i'm not sure), following code should need.

global $wpdb; $flavors=$wpdb->get_col('select `meta_value` `' . $wpdb->prefix . 'postmeta` `meta_key`=\'flavor\' group `meta_value`;'); if (count($flavors) > 0) {     foreach ($flavors $flavor)     {     //do whatever need $flavor (meta_value)     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -