I have a problem with pagination on search results page. First time it working after I click on submit button in search form.
The problem when I click on pagination, $_POST get null.
Thanks for help
<?php
foreach($_POST as $key => $value){
if($value != ''){
$item['taxonomy'] = htmlspecialchars($key);
$item['terms'] = htmlspecialchars($value);
$item['field'] = 'term_id';
$list[] = $item;
}
}
$cleanArray = array_merge(array('relation' => 'AND'), $list);
$args['post_type'] = 'listings';
$args['showposts'] = 12;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args['paged'] = $paged;
$args['tax_query'] = $cleanArray;
$the_query = new WP_Query( $args ); //data is sanitized inside wp_query class
while ( $the_query->have_posts() ) : $the_query->the_post();
the_title();
endwhile;
?>
Try this code