WordPress paginate_comments_links() Function

Beginner
5 min read
Updated: Nov 2026
3 examples
Template tag

Definition

In WordPress, paginate_comments_links() prints numbered page links for the comments of a post, such as 1, 2, 3, and Next.

It works only on single posts and only when Break comments into pages is on in Settings → Discussion. It uses paginate_links() inside.

Syntax

Call it with no arguments, or pass an array to change the text and the type.

WordPress
paginate_comments_links();
paginate_comments_links( array( 'prev_text' => 'Back', 'next_text' => 'Forward' ) );
CallWhat it does
paginate_comments_links()Prints the page links with default text.
paginate_comments_links( array( 'prev_text' => 'Back' ) )Changes the text of the Previous link.
paginate_comments_links( array( 'echo' => false ) )Returns the links instead of printing them.

The arguments are the same as for paginate_links(), for example prev_text, next_text, type, end_size, and mid_size.

Full declaration
WordPress
paginate_comments_links( string|array $args = array() ): void|string|array

Parameters

ParameterDescription
$argsOptional. A query string or an array of options. It accepts the options of paginate_links(), such as prev_text, next_text, type, end_size, mid_size, and echo.

Return Value

Return ValueDescription
void|string|arrayPrints the links by default and returns nothing. With 'echo' => false, it returns a string. With 'type' => 'array', it returns an array.

WordPress Examples

Three short theme examples. Each one has a sample output.

Example 1 — Default links

Print the numbered links under the comments.

WordPress
<nav class="comment-pages">
  <?php paginate_comments_links(); ?>
</nav>

How It Works

  1. The visitor is on comment page 1.
  2. The current page is a span. Other pages are links.
  3. A Next link is added automatically.

Example 2 — Custom text

Change the Previous and Next text.

WordPress
<?php
paginate_comments_links( array(
  'prev_text' => 'Back',
  'next_text' => 'Forward',
) );
?>

How It Works

  1. prev_text and next_text set the labels.
  2. The visitor is on comment page 2.
  3. Page number links are still printed.

Example 3 — As a list

Print the page links as an unordered list.

WordPress
<?php paginate_comments_links( array( 'type' => 'list' ) ); ?>

How It Works

  1. type set to list makes a ul.
  2. Each link is inside an li.
  3. Lists are easy to style with CSS.

Frequently Asked Questions

It prints numbered page links for the comments of a post.
Comment paging may be off, there may be only one page of comments, or you are not on a single post.
Pass prev_text and next_text in the arguments array.
Pass 'echo' => false.
previous_comments_link() and next_comments_link() print one link each.

Next: permalink_comments_rss()

Old template tag for the comments feed link. Use modern feed functions instead.

permalink_comments_rss() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful