wordpress 3.8.1 category page 2 error 404 not found / custom post type

admin

Administrator
Staff member
first the problem, then the tries.

<h2>Problem</h2>

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. (<a href="http://mypage.com/category/properties" rel="nofollow noreferrer">http://mypage.com/category/properties</a>)

After i click on the "Next page" button I'm on the page <a href="http://mypage.com/category/properties/page/2" rel="nofollow noreferrer">http://mypage.com/category/properties/page/2</a> and got the error 404 NOT FOUND.

<strong>But why?</strong>

<h2>Tries</h2>

First I tried this Question <a href="https://stackoverflow.com/questions/8269713/custom-post-type-and-taxonomy-pagination-404-error">Custom Post Type and Taxonomy pagination 404 error</a>, but the
Code:
exclude_from_search
and the queries below doesnt work.

I tried this, too. <a href="http://wordpress.org/support/topic/one-again-page-not-found-on-second-and-further-pages" rel="nofollow noreferrer">http://wordpress.org/support/topic/one-again-page-not-found-on-second-and-further-pages</a>
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 -.-

<h2>Example / PHP</h2>

Code:
&lt;?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-&gt;query, array(
    'posts_per_page' =&gt; 4,
    'post_type' =&gt; 'property',
    'post_status' =&gt; 'publish',
    'meta_key' =&gt; 'property_typ',
    'meta_value' =&gt; 'Rent',
    'category_name' =&gt; null
));

$wp_query = new WP_Query($args);

echo '&lt;ul&gt;';
while (have_posts())
{
    the_post();
    echo '&lt;li&gt;&lt;a href="' . get_permalink(get_the_id()) . '"&gt;'
         . get_the_title() . '&lt;/a&gt;&lt;/li&gt;';
}
echo '&lt;/ul&gt;';

echo paginate_links(array(
    'base' =&gt; str_replace(99999, '%#%', esc_url(get_pagenum_link(99999))),
    'total' =&gt; $wp_query-&gt;max_num_pages,
    'format' =&gt; '?paged=%#%',
    'current' =&gt; max(1, get_query_var('paged'))
));

<h2>Results</h2>

<strong>Page 1</strong>

<img src=" " alt="Page 1">

<strong>Page 2</strong>

<img src=" " alt="Page 2">