Filtering variable WooCommerce products by stock level using meta_query

you are not showing $quantity, maybe that is off? this one here definitely works: $args = [ ‘post_type’ => ‘product_variation’, ‘posts_per_page’ => 100, ‘meta_query’ => [ [ ‘key’ => ‘_stock’, ‘value’ => 0, ‘compare’ => ‘>’, ‘type’ => ‘NUMERIC’ ] ] ]; $query = new WP_Query($args); with this query, you get all variations, that are … Read more

Order by meta value (numeric value lower to higher)

I think that what you’re looking for is this: <?php $tours = new WP_Query(array( ‘post_type’ => ‘tour’, ‘posts_per_page’=> 12, ‘meta_key’ => ‘tour_price’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ )); Descending means going down, as in, high to low. Ascending is going up, low to high.

Exclude posts from main loop based on meta value

Dave, your code seems good except a couple things in it, so please try it: function exclude_featured_post( $query ) { if ( is_front_page() && $query->is_main_query() ) { $meta_query = $query->get(‘meta_query’) ? $query->get(‘meta_query’) : array(); // append yours $meta_query[] = array( ‘key’ => ‘featured_post’, // please make sure that key is correct ‘value’ => ‘1’, ‘compare’ … Read more

Tax query AND/OR meta query [duplicate]

It’s not possible without a more custom query/filter. I have achieved it with a filter (code taken from this guy on this gist – https://gist.github.com/elvismdev/61f8509eff8abcc21ef84154b74fbf56) function f1_egpaf_meta_or_tax( $where, \WP_Query $q ) { // Get query vars. $tax_args = isset( $q->query_vars[‘tax_query’] ) ? $q->query_vars[‘tax_query’] : null; $meta_args = isset( $q->query_vars[‘meta_query’] ) ? $q->query_vars[‘meta_query’] : null; $meta_or_tax … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)