I am using Verve Meta Boxes. I want to create a menu from one of the custom fields. How can I return all custom field values? For example, if I had a custom selection field called “fruits” and I had “apples”, “oranges” and “bananas” as parameters, how can I get a complete list of these values, for example, as an array? I can get messages related to the message:
get_post_custom_values('fruit')
... but I can’t figure out how to get the whole list.
Thank you in advance!
If anyone is still interested:
global $wpdb; $results = $wpdb->get_results( 'SELECT DISTINCT meta_value FROM wp_postmeta WHERE meta_key LIKE "FIELD_NAME"', OBJECT );
, postmeta - "wp_postmeta" ( ) FIELD_NAME , admin.
Wordpress, get_post_meta .
:
$fruits = trim(get_post_meta($post->ID,'fruits',true)); $fruits_array = explode(',',$fruits); foreach($fruits_array as $f){ echo $f.'<br/>'; }
, .
,
. , , , , , . .