I am trying to get the latest post with a meta value of headline, but it gives me the latest post made instead. Here is my query, what am i doing wrong?
$querydetails = "
SELECT $wpdb->posts.*
FROM $wpdb->posts, $wpdb->postmeta
WHERE $wpdb->posts.ID = $wpdb->postmeta.post_id
AND $wpdb->postmeta.meta_value = 'headline'
AND $wpdb->postmeta.meta_key = 'custom_select'
AND $wpdb->posts.post_status = 'publish'
AND $wpdb->posts.post_type = 'post'
ORDER BY $wpdb->posts.post_date DESC
LIMIT 1
";
$headline = $wpdb->get_results($querydetails, OBJECT);