get_cancel_comment_reply_link

函式
get_cancel_comment_reply_link ( $text = '' )
引數
  • (string) $text Optional. Text to display for cancel reply link. If empty, defaults to 'Click here to cancel reply'. Default empty.
    Required:
    Default: (empty)
返回值
  • (string)
定義位置
相關方法
cancel_comment_reply_linkget_comment_reply_linkcomment_reply_linkget_next_comments_linkget_edit_comment_link
引入
2.7.0
棄用
-

get_cancel_comment_reply_link:此函式檢索HTML連結以取消註釋回覆表單。它接受兩個引數:$text和$type。$text引數是要在連結中顯示的文字,$type引數是要用於連結的HTML元素型別。預設情況下,連結顯示為元素。

檢索取消評論回覆連結的HTML內容。

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>';

	/**
	 * Filters the cancel comment reply link HTML.
	 *
	 * @since 2.7.0
	 *
	 * @param string $formatted_link The HTML-formatted cancel comment reply link.
	 * @param string $link           Cancel comment reply link URL.
	 * @param string $text           Cancel comment reply link text.
	 */
	return apply_filters( 'cancel_comment_reply_link', $formatted_link, $link, $text );
}

常見問題

FAQs
檢視更多 >