first a problem, then an attempt.
Problem
The problem is that I get a 404 NOT FOUND error if I visit a different page than the first category page. On the category page, I have the usual pagination. The first site is working. ( http://mypage.com/category/properties )
After I click the "Next Page" button, I am on the page http://mypage.com/category/properties/page/2 and received a 404 NOT FOUND error.
But why?
Is trying
At first I tried this question Custom post type and pagination 404 taxonomy , but exclude_from_searchthe queries below do not work either.
I tried it too. http://wordpress.org/support/topic/one-again-page-not-found-on-second-and-further-pages
But trying query_posts has the same result as WP_Query.
I also tried an event with a preliminary request. But the problem is the same. -
Example / PHP
<?php
global $wp_query;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array_merge($wp_query->query, array(
'posts_per_page' => 4,
'post_type' => 'property',
'post_status' => 'publish',
'meta_key' => 'property_typ',
'meta_value' => 'Rent',
'category_name' => null
));
$wp_query = new WP_Query($args);
echo '<ul>';
while (have_posts())
{
the_post();
echo '<li><a href="' . get_permalink(get_the_id()) . '">'
. get_the_title() . '</a></li>';
}
echo '</ul>';
echo paginate_links(array(
'base' => str_replace(99999, '%#%', esc_url(get_pagenum_link(99999))),
'total' => $wp_query->max_num_pages,
'format' => '?paged=%#%',
'current' => max(1, get_query_var('paged'))
));
results
Page 1

Page 2

source
share