i have a dropdown with meta data from posts:

$metakey = 'city';
    $counties = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta AND post_status = published WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );
    if ($counties) {
    foreach ($counties as $city) {
    echo "<option value="" . $city . "">" . $city . "</option>";


AND post_status = published

seems to be wrong here. any idea how to show only the meta data from published posts? i get the posts per RSS feed with the plugin “FeedWordPress” and he puts the old posts to post status “retired” so they are shown. no i found no option in the plugin to put them to trash instead …

Read more here: WordPress - get meta data only from "published" articles


If you know the solution of this issue, please leave us a reply in Comment section, to update the question.

Related Wordpress search:

, , , ,

Wordpress related questions and answers: