WordPress pagination not working after first wp_query. I am performing some operations on the data returned by first wp_query object. but after the second query, pagination is not working.
<?php
$prop_no = intval( get_option('wp_estate_prop_no', '') );
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
'post_type' => 'estate_property',
'author' => $current_user->ID,
'paged' => $paged,
'posts_per_page' => $prop_no,
'post_status' => array( 'any' ),
);
$prop_selection = new WP_Query($args);
//some code
$args = array(
'post_type' => 'estate_property',
'author' => $current_user->ID,
'paged' => $paged,
'posts_per_page' => $prop_no,
'post__in' => $sorted_posts,
'orderby' => 'post__in'
);
$prop_selection = new WP_Query($args);
?>
I tried removing the ‘paged’ parameter from one of the queries, that gives either wrong results or no pagination. ex. this query returns 28 results first time but only returns 6 results after second query. And if I remove the ‘paged’ parameter from first query and add it to second query then only one page is returned when it should return 3 pages.
Create Function in
function.php
Get Pagination Your
listing page
Define Before loop
Use After Loop
See pagination http://hiddenwhy.igexsolutions.com/blog/