WordPress – Optimize the Meta Query for 3 meta keys at a time

Conclusion – In my case I tried below When I changed placement of last meta or at the first place worked perfectly. <?php $price_from = ’20’; $price_to = ‘700’; $meta_query_price[] = array( ‘relation’ => ‘OR’, array( ‘key’ => ‘price_type’, ‘value’ => ‘POA’, ‘type’ => ‘value’, ‘compare’ => ‘LIKE’ ), array( ‘relation’ => ‘AND’, array( ‘key’ … Read more

WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)

Resolved. My error are there : $FirstDayThisMonth[] = date(‘Y-m-01 00:00:01’, mktime(0, 0, 0, $x, 1)); $LastDayThisMonth[] = date(‘Y-m-t 23:59:59’, mktime(0, 0, 0, $x, 1)); instead of : $datestart = strtotime(date(‘Y-‘.$nbofmonth.’-01 00:00:01′)); $dateend = strtotime(date(‘Y-‘.$nbofmonth.’-t 23:59:59′)); It’s always very annoying to have well written code and to realize that a small element breaks everything

Using WP Query, I want to include all posts in category 1 as long as they are not also in category 2

I think, you can try this type of code. $args = array( ‘post_type’ => ‘product’, ‘meta_key’ => ‘sorting_weight’, ‘orderby’ => ‘meta_value_num’, ‘posts_per_page’ => – 1, ‘order’ => ‘DESC’, ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, ‘terms’ => 81, // category 1 ), array( ‘taxonomy’ => ‘product_cat’, ‘field’ => ‘term_id’, … Read more

How do I exclude the current post from the upcoming post query

I think you are asking how to exclude the current exhibition from your upcoming exhibitions query. If that is the case, simply insert the ID of the current exhibition into the query using ‘post__not_in’: $exhibition_upcoming_query = array( ‘post_type’ => ‘exhibition’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’, ‘posts_per_page’ => 3, ‘post__not_in’ => array( $exhibition_current_loop->posts[0]->ID ), ‘meta_query’ … Read more