get_cancel_comment_reply_link

Advertisement

Summery Summery

Retrieves HTML content for cancel comment reply link.

Syntax Syntax

get_cancel_comment_reply_link( string $text = '' )

Parameters Parameters

$text

(Optional) Text to display for cancel reply link.

Default value: ''

Return Return

(string)

Source Source

File: wp-includes/comment-template.php

/**
 * Retrieves HTML content for cancel comment reply link.
 *
 * @since 2.7.0
 *
 * @param string $text Optional. Text to display for cancel reply link. If empty,
 *                     defaults to 'Click here to cancel reply'. Default empty.
 * @return string
 */
function get_cancel_comment_reply_link( $text = '' ) {
	if ( empty( $text ) ) {
		$text = __( 'Click here to cancel reply.' );
	}

	$style = isset( $_GET['replytocom'] ) ? '' : ' style="display:none;"';
	$link  = esc_html( remove_query_arg( array( 'replytocom', 'unapproved', 'moderation-hash' ) ) ) . '#respond';

	$formatted_link = '<a rel="nofollow" id="cancel-comment-reply-link" href="' . $link . '"' . $style . '>' . $text . '</a>';

	/**

Advertisement

Changelog Changelog

Changelog
Version Description
2.7.0 Introduced.

Advertisement

Leave a Reply