2

Tax query is formed wrong. It also array of arrays(queries) get_posts([ 'meta_query' => [ [ 'key' => 'country', 'value' => 'Japan', 'compare' => 'LIKE' ] ], 'tax_query' => [ [ 'taxonomy' => 'category', 'field' => 'slug', 'terms' ...


2

Note that the correct compare value is EXISTS and not EXIST. post_id is also not a valid/standard parameter for a meta query clause. :) But 'compare' => 'EXIST' is equivalent to 'compare' => '=', i.e. the default compare value is =, therefore your meta query worked and only posts with the meta (regardless the value is empty or not) included in the ...


1

Your code is interfering with the internal structure of WP_Query and WP_Post, and making assumptions about how it works. This is extremely unusual, and not best practice when developing with WordPress. Case in point, officially there is no post_meta member variable on that class ( https://developer.wordpress.org/reference/classes/wp_post/ ). That's not how ...


1

I had a similar issue but couldn't solved with the snippets on this thread. I had to order a query by: all 'featured' posts first (is_it_a_featured_etf) and by a numeric field (etf_aum) in DESC order after the featured ones. My solution: 'meta_query' => [ 'relation' => 'OR', 'etf_aum' => array( 'key' => 'etf_aum', 'type'...


Only top voted, non community-wiki answers of a minimum length are eligible