get_comment_author_ip

函式
get_comment_author_ip ( $comment_ID = 0 )
引數
  • (int|WP_Comment) $comment_ID Optional. WP_Comment or the ID of the comment for which to get the author's IP address. Default current comment.
    Required:
返回值
  • (string) Comment author's IP address, or an empty string if it's not available.
定義位置
相關方法
get_comment_authorget_comment_author_linkget_comment_author_emailcomment_author_ipget_comment_author_url
引入
1.5.0
棄用
-

get_comment_author_ip: 這個函式返回評論的作者的IP地址。它需要一個引數,即$comment_ID,這是你想檢索作者IP的評論的ID。

檢索當前評論的作者的IP地址。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
$comment = get_comment( $comment_ID );
/**
* Filters the comment author's returned IP address.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.
* @param string $comment_ID The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
}
function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid $comment = get_comment( $comment_ID ); /** * Filters the comment author's returned IP address. * * @since 1.5.0 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added. * * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available. * @param string $comment_ID The comment ID as a numeric string. * @param WP_Comment $comment The comment object. */ return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase }
function get_comment_author_IP( $comment_ID = 0 ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
	$comment = get_comment( $comment_ID );

	/**
	 * Filters the comment author's returned IP address.
	 *
	 * @since 1.5.0
	 * @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
	 *
	 * @param string     $comment_author_ip The comment author's IP address, or an empty string if it's not available.
	 * @param string     $comment_ID        The comment ID as a numeric string.
	 * @param WP_Comment $comment           The comment object.
	 */
	return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
}

常見問題

FAQs
檢視更多 >