How to Add Pagination to Comments in WordPress

A large number of comments in WordPress post page increases the page load time. Depending on the number of comments post page will take the time to load and sometimes the page is crashed if there are huge numbers of comments are available. If you’re receiving lots of comments for posts, it might be a good choice to add pagination to comments on your WordPress site. Paginated comments speed up post page and load the page faster.

Comments with pagination displays the certain number of comments on initial page load. Other comments will be loaded by clicking on the pagination links. WordPress provides an easy way to add pagination to comments listing. In this tutorial, we’ll show you how you can easily add pagination links on comments list in WordPress.

Enable Paged Comment

To breaks comments into pages, you’ll need to modify the following settings in WordPress Administrative panel.
Log into the WP administrative panel and navigate to Settings » Discussion. Go to the Other comment settings section and select the checkbox where it says Break comments into pages….. Enter the numbers of comments you want to display on every page and choose how you wants to display them.


Scroll down the page and Save Changes.

Add Pagination Links to Comment Template

Use paginate_comments_links() function in WordPress to output the comments navigation links under the comments list. Open the comments.php template file and place the following line of code under the comments list.

<?php paginate_comments_links(); ?>

Also, you can pass various arguments to control the comments navigation links. The following arguments will display NEXT and PREV link on comment pagination.

<?php paginate_comments_links( array('prev_text' => '&laquo; PREV''next_text' => 'NEXT &raquo;') ); ?>

Once you completed the above-mentioned steps, the pagination links will appear under the comments lists on the post page.

Related Articles

Comments 0