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 )

Displays text based on comment reply status.


Description

Only affects users with JavaScript disabled.


Parameters

$no_reply_text

(Optional) Text to display when not replying to a comment.<br>

Default value: false

$reply_text

(Optional) Text to display when replying to a comment.<br> Accepts "%s" for the author of the comment being replied to.

Default value: false

$link_to_parent

(Optional) Boolean to control making the author's name a link to their comment.

Default value: true

$post

(Optional) The post that the comment form is being displayed for.<br> Defaults to the current global post.

Default value: null


Source

File: wp-includes/comment-template.php

function comment_form_title( $noreplytext = false, $replytext = false, $linktoparent = true ) {
	global $comment;

	if ( false === $noreplytext ) $noreplytext = __( 'Leave a Reply' );
	if ( false === $replytext ) $replytext = __( 'Leave a Reply to %s' );

	$replytoid = isset($_GET['replytocom']) ? (int) $_GET['replytocom'] : 0;

	if ( 0 == $replytoid )
		echo $noreplytext;
	else {
		// Sets the global so that template tags can be used in the comment form.
		$comment = get_comment($replytoid);
		$author = ( $linktoparent ) ? '<a href="#comment-' . get_comment_ID() . '">' . get_comment_author( $comment ) . '</a>' : get_comment_author( $comment );
		printf( $replytext, $author );
	}
}


Changelog

Changelog
Version Description
6.2.0 Added the $post parameter.
2.7.0 Introduced.