WordPress previous_comments_link() Function

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

Definition

In WordPress, previous_comments_link() prints a link to the previous page of comments. The default text is « Older Comments.

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

Syntax

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

WordPress
previous_comments_link();
previous_comments_link( '« Older comments' );
CallWhat it does
previous_comments_link()Prints the link with the default text.
previous_comments_link( '« Older' )Prints the link with your own text.
get_previous_comments_link()Returns the link instead of printing it.

Nothing is printed on the first page of comments.

Full declaration
WordPress
previous_comments_link( string $label = '' ): void

Parameters

ParameterDescription
$labelOptional. The text of the link. Default « Older Comments.

Return Value

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

WordPress Examples

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

Example 1 — Default link

Print the link to the previous page.

WordPress
<div class="nav-previous"><?php previous_comments_link(); ?></div>

How It Works

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

Example 2 — Custom label

Use your own text.

WordPress
<?php previous_comments_link( 'Show older 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 — On the first page

See what happens on the first page of comments.

WordPress
<div class="nav-previous"><?php previous_comments_link(); ?></div>

How It Works

  1. There is no earlier page of comments.
  2. WordPress prints nothing.
  3. Your wrapper stays empty. Hide it with CSS if you need to.

Frequently Asked Questions

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

Next: wp_list_comments()

Print the whole list of comments for a post, with nesting and avatars.

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

12 people found this page helpful