WP_QUERY order posts by two combined meta_value dates

On post insert/update, set the post’s menu_order as the maximum of the numeric MMDD values of original_date and featured_date. Maybe set the menu order in the format 1MMDD to avoid a leading zero. Then we can order the custom type posts by the menu order very fast with: WP_Query( [ ‘post_type’ => ‘custom_post_type’, ‘orderby’ => … Read more

Custom Woocommerce Product Query

Try this $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘product’, ‘meta_key’ => ‘var_confirmed_date’, ‘meta_type’ => ‘DATE’, ‘orderby’ => ‘meta_value_date’, ‘order’ => ‘ASC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘destination’, ‘field’ => ‘id’, ‘terms’ => array($t_id) ) ), ‘meta_query’ => array( array( ‘key’ => ‘var_confirmed_date’, ‘value’ => date(“Y-m-d”,time()), ‘compare’ => ‘>=’, ‘type’ => ‘DATE’, ), … Read more