W3cubDocs

/WordPress

comment_form_title( string $noreplytext = false, string $replytext = false, string $linktoparent = true )

Display text based on comment reply status.

Description

Only affects users with JavaScript disabled.

Parameters

$noreplytext

(string) (Optional) Text to display when not replying to a comment.

Default value: false

$replytext

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

Default value: false

$linktoparent

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

Default value: true

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

Version Description
2.7.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/comment_form_title