I’m looking to get all unique custom field values.
Currently I’m just looping through all posts, saving to an array, then removing dupes however I feel like there should be a better way to do this.
$unique_non_blank_values = $wpdb->get_results( "SELECT DISTINCT meta_value FROM ".$wpdb->postmeta." WHERE meta_key = 'YourMetaKey' AND meta_value <>'' ORDER BY meta_value DESC");
maybe this way?
my sql skills are non existent 😛 . I’ll try it out though! thanks!