Answer the question
In order to leave comments, you need to log in
Why is wp_query not working correctly when using pagination?
In general, I give an example of my wp_query request when filtering products:
$args = array(
'post_type' => 'product',
'posts_per_page' => 2,
'meta_key' => '_price',
'orderby' => 'meta_value_num',
'order' => 'ASC',
'paged' => $current_page,
'tax_query' => array(
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $current_cat
)
);
$query_pagination = new WP_Query( $args );
Answer the question
In order to leave comments, you need to log in
In general, no one noticed the campaign, maybe this is not only my frequent mistake)
I forgot to specify the second array in this place:
'tax_query' => array(
array => (
'taxonomy' => 'product_cat',
'field' => 'id',
'terms' => $current_cat
)
)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question