WordPress next_comments_link() Function

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

Definition

In WordPress, next_comments_link() prints a link to the next page of comments. The default text is Newer Comments ».

It works only when you turn on Break comments into pages in Settings → Discussion. Use it together with previous_comments_link().

Syntax

Call it with no text for the default label, or set your own label.

WordPress
next_comments_link();
next_comments_link( 'Newer comments »' );
CallWhat it does
next_comments_link()Prints the link with the default text.
next_comments_link( 'Newer »' )Prints the link with your own text.
next_comments_link( 'Newer »', 5 )Sets the last page number yourself.

Nothing is printed on the last page of comments.

Full declaration
WordPress
next_comments_link( string $label = '', int $max_page = 0 ): void

Parameters

ParameterDescription
$labelOptional. The text of the link. Default Newer Comments ».
$max_pageOptional. The last page number. Default 0, which means WordPress finds it.

Return Value

Return ValueDescription
voidNothing is returned. The function prints one link, or nothing on the last page.

WordPress Examples

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

Example 1 — Default link

Print the link to the next page.

WordPress
<div class="nav-next"><?php next_comments_link(); ?></div>

How It Works

  1. The visitor is on comment page 1.
  2. WordPress builds a link to page 2.
  3. The link ends with #comments.

Example 2 — Custom label

Use your own text.

WordPress
<?php next_comments_link( 'Show newer comments' ); ?>

How It Works

  1. The first argument is the link text.
  2. The link address does not change.
  3. Keep the text short.

Example 3 — Previous and next

Show both links in a comment navigation.

WordPress
<nav class="comment-nav">
  <?php previous_comments_link( '&laquo; Older' ); ?>
  <?php next_comments_link( 'Newer &raquo;' ); ?>
</nav>

How It Works

  1. The visitor is on comment page 2.
  2. previous_comments_link() goes back one page.
  3. next_comments_link() goes forward one page.

Frequently Asked Questions

It prints a link to the next page of comments.
Comment paging may be off, or you are on the last page of comments.
Go to Settings, Discussion, and turn on Break comments into pages.
Use previous_comments_link().
Yes. Use paginate_comments_links() for page numbers.

Next: paginate_comments_links()

Print numbered page links for a post with many comments.

paginate_comments_links() 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.

9 people found this page helpful