WordPress comment_form_title() Function

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

Definition

In WordPress, comment_form_title() prints the heading above the comment form. It shows Leave a Reply by default.

When a visitor replies to a comment, it shows Leave a Reply to Jane Doe. It works for visitors whose JavaScript is off, or when the reply script is not loaded.

Syntax

Call it with no text for the defaults, or set the two texts. Use %s for the name.

WordPress
comment_form_title();
comment_form_title( 'Leave a comment', 'Reply to %s' );
comment_form_title( 'Leave a comment', 'Reply to %s', false );
CallWhat it does
comment_form_title()Prints the default heading text.
comment_form_title( 'Leave a comment', 'Reply to %s' )Prints your own heading and reply text.
comment_form_title( 'Leave a comment', 'Reply to %s', false )Prints the author name without a link.

comment_form() already prints this heading in its own title area.

Full declaration
WordPress
comment_form_title( string|false $no_reply_text = false, string|false $reply_text = false, bool $link_to_parent = true, int|WP_Post|null $post = null ): void

Parameters

ParameterDescription
$no_reply_textOptional. Text to print when the visitor is not replying. Default Leave a Reply.
$reply_textOptional. Text to print when replying. Use %s for the author name. Default Leave a Reply to %s.
$link_to_parentOptional. If true, the author name links to the comment. Default true.
$postOptional. A post ID or WP_Post object. Default is the current post.

Return Value

Return ValueDescription
voidNothing is returned. The function prints the heading text.

WordPress Examples

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

Example 1 — Default heading

Print the default form heading.

WordPress
<h3><?php comment_form_title(); ?></h3>

How It Works

  1. The visitor is not replying to a comment.
  2. WordPress prints the default text.
  3. The text is translated if your site language is not English.

Example 2 — Custom text

Write your own text for both cases.

WordPress
<h3><?php comment_form_title( 'Share your thoughts', 'Reply to %s' ); ?></h3>

How It Works

  1. This output shows a visit with ?replytocom=12 in the URL.
  2. %s is replaced by the name of the comment author.
  3. Without a reply, the first text is printed.

Frequently Asked Questions

It prints the heading above the comment form, and changes it to Reply to a name when a visitor replies.
It is replaced by the name of the comment author being replied to.
No. comment_form() prints its own heading.
Yes. Pass false as the third argument.
From the replytocom value in the URL.

Next: comment_ID()

Print the numeric ID of the current comment.

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

13 people found this page helpful