1

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.

category.php

<?php
while (have_posts()) {
    the_post();
    ?>
    <div>
        <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>
        </p>
    </div>
    <?php
}
echo paginate_links();
?>

Above code works fine for index.php

Thanks in Advance :)

0

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

localhost/category/abc

and it works fine.

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.