comment_link

函数
comment_link ( $comment = null )
参数
  • (int|WP_Comment) $comment Optional. Comment object or ID. Defaults to global comment object.
    Required:
    Default: null
定义位置
相关方法
comments_linkget_comment_linkget_comments_linkedit_comment_linkcomments_rss_link
引入
1.5.0
弃用
-

comment_link: 这个函数生成一个指向当前评论的链接。它可以用来创建一个固定链接到一个文章或页面上的特定评论。

显示评论的链接。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function comment_link( $comment = null ) {
/**
* Filters the current comment's permalink.
*
* @since 3.6.0
*
* @see get_comment_link()
*
* @param string $comment_permalink The current comment permalink.
*/
echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
}
function comment_link( $comment = null ) { /** * Filters the current comment's permalink. * * @since 3.6.0 * * @see get_comment_link() * * @param string $comment_permalink The current comment permalink. */ echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) ); }
function comment_link( $comment = null ) {
	/**
	 * Filters the current comment's permalink.
	 *
	 * @since 3.6.0
	 *
	 * @see get_comment_link()
	 *
	 * @param string $comment_permalink The current comment permalink.
	 */
	echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
}

常见问题

FAQs
查看更多 >