first the problem, then the tries.
Problem
The problem is that i get a 404 NOT FOUND error if i visit another page than the first category page.
On the category page i have a normal pagination. The first site works. (http://mypage.com/category/properties)
After i click on the “Next page” button I’m on the page http://mypage.com/category/properties/page/2 and got the error 404 NOT FOUND.
But why?
Tries
First I tried this Question Custom Post Type and Taxonomy pagination 404 error, but the exclude_from_search
and the queries below doesnt work.
I tried this, too. http://wordpress.org/support/topic/one-again-page-not-found-on-second-and-further-pages
But the query_posts try has the same result as the WP_Query try.
The event with the pre query i tried, too. But the problem is the same -.-
Example / PHP
<?php
/* /srv/www/mypage/wp-content/themes/twentythirteen/category-1.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
Try change the pre_get_posts filter.
Found this at http://css-tricks.com/snippets/wordpress/make-archives-php-include-custom-post-types/
Try this, it should work.had similar problem
I had the same problem with my custom post taxonomies pagination. Older posts page was coming with a 404 page not found. This issue is related to WP taxonomy slug so you have to rewrite rules for your custom post type taxonomies like this below:
This should work for all custom post type taxonomies and just use your default query loop without passing any arguments. Pages will be generated based on General -> Reading.