Support » Fixing WordPress » WordPress pagination not working because its a subcategory

  • Hi there,

    Currently I’m facing a really strange problem I can’t seem to fix normally.
    I’ve using pagination on my category pages. I’ve got a ‘News’ category with some sub categories. One sub category is ‘MVO nieuws’.

    When I visit ‘/mvo-nieuws’ the pagination is working (showing an older posts link).

    if ($paged) : ?>
      <nav class="page-nav archive">
        <?php if ($prev = get_previous_posts_link()) : ?>
          <div class="alignleft">
            <span class="fo icons-angle-circled-left"></span>
            <span><?php previous_posts_link( 'Nieuwe berichten' ); ?></span>
        <?php endif;
        if ($next = next_posts($listPosts->max_num_pages, false)) : ?>
          <div class="alignright">
    	   <a href="<?= $next; ?>">Oudere berichten</a>
    	<span class="fo icons-angle-circled-right"></span>
        <?php endif; ?>
    <?php endif; ?>

    The pagination is forwarding to '/mvo-nieuws/page/2', but that page couldn’t be found. I’ll found out this is because its a subcategory of ‘News’, but I don’t know why this seems to be a problem.

    I’ve removed the category as a subcategory and now it’s working. All my other primary categories are also working fine, but the subcategories are facing this problem.

    My permalink settings are: '/%category%/%postname%/'.
    Hopefully anyone can help me out, thanks in forward!

Viewing 1 replies (of 1 total)
  • Somehow I can’t edit this post anymore, but I thought it might be helpfull to add my WP_Query this topic.

    $cat = get_query_var('cat');
    $category = get_category($cat);
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $listArgs = array(
        'cat' => $category->term_id,
        'paged' => $paged,
        'posts_per_page' => 11
    $listPosts = new WP_Query($listArgs);
    while ($listPosts->have_posts()) :

    Also I’ve found out that not only subcategories are facing this problem, but all the categories with paginations. Hopefully someone can help me out!

Viewing 1 replies (of 1 total)
  • The topic ‘WordPress pagination not working because its a subcategory’ is closed to new replies.