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
檢視更多 >