Just wondered if someone could spare 5 mins to help me understand where I might be going wrong.
I have a set of custom fields for jobs - I would like to create two drop down menus as a quick search:
Categories for example - IT, Warehousing, Sales... Salary - 20-30k
I have cobbled together this query -
$myquery = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value, post_status FROM $wpdb->postmeta, $wpdb->posts WHERE meta_key = %s AND post_status IN ('publish') ", $metakey));
With this query, it does populate a drop down list, however, it's still including 'drafts' - in the drop down.
So, how would I exclude 'draft pages' from populating the drop down?