get posts whether meta_key exists or not
Thanks to @Hobo’s answer which gave me the clue for moving pm2 condition to the join statement SELECT p.ID, p.post_content, p.post_title, p.post_excerpt, pm1.meta_value as meal_date, pm2.meta_value as meal_plan, t.name as meal_type FROM wp_posts AS p LEFT JOIN wp_term_relationships AS r ON (p.ID = r.object_id) INNER JOIN wp_term_taxonomy AS x ON (r.term_taxonomy_id = x.term_taxonomy_id) INNER JOIN … Read more