404 when I combine taxonomy filter with pagination

Question

I have created a custom archive page and I’ve created my custom post type using CPT.
I’ve managed to add pagination but I have also created a filter using custom taxonomy and when I use the filter with pagination my site is returning 404,
for example,

mypage/myarchive/?paged=2&color[]=red&color[]=blue

Here is the code I use for pagination:

if( $wp_query->max_num_pages > 1 ) {
echo paginate_links( array(
   'total'        => $wp_query->max_num_pages,
   'current'      => max( 1, get_query_var( 'paged' ) ),
    'format'       => '?paged=%#%',
   'end_size'     => 2,
   'mid_size'     => 1,
   'prev_next'    => true,
   'prev_text'    => sprintf( '<i class="fas fa-chevron-left"></i>' ),
   'next_text'    => sprintf( '<i class="fas fa-chevron-right"></i>' ),

) ); 
}
0
Wilmar Arias 2 months 0 Answers 8 views 0

Leave an answer