List custom field values in alphabetical order without repetition
You could do a custom SQL query: global $wpdb; $query = “SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = ‘director’ ORDER BY meta_value;”; $directors = $wpdb->get_results( $query ); foreach( $directors as $director ) : echo $director->meta_value; endforeach; one thing to note here though is that since you’re not querying the associated posts, you could get … Read more