Get a single post by a unique meta value
I am just incredible stupid here as this can be easily done by a simple WP_Query: new WP_Query( array( ‘post_type’ => ‘shop_order’, ‘meta_key’ => $meta_key, ‘meta_value’ => $meta_value ) ) However, I decided to compare the actual generated SQL of the get_posts() with a ‘post_where’ filter solution which is: SELECT wp_posts.ID FROM wp_posts WHERE 1=1 … Read more