I am trying to develop my own Wordpress theme and want to add pagination in category page by call paginate_links() function. It will generate the links [1,2,... Next] perfectly but when I click on 2 page it will throw the 404 error. For example...

Category link: localhost/abc ---> 202

2 Page link: localhost/abc/page/2 ---> 404

Where abc is the name of the category.


while (have_posts()) {
        <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
        <p> <?php echo get_the_excerpt(); ?>
            <a href="<?php the_permalink(); ?>">Continue reading &raquo;</a>
echo paginate_links();

Above code works fine for index.php

Thanks in Advance :)


My problem is solved. To work pagination for a category, the category URL must be like...


and it works fine.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.