get_comment_author_IP() - WordPress 函数参考中文文档

返回介绍

get_comment_author_IP()

发布于 2017-09-10 字数2090 浏览 872 评论 0

get_comment_author_IP( int|WP_Comment $comment_ID )

Retrieve the IP address of the author of the current comment.


描述


参数

$comment_ID

(int|WP_Comment)
(Optional)
WP_Comment or the ID of the comment for which to get the author’s IP address. Default current comment.


返回值

(string) Comment author’s IP address.


源代码

File: wp-includes/comment-template.php

function get_comment_author_IP( $comment_ID = 0 ) {
	$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.
	 * @param int        $comment_ID        The comment ID.
	 * @param WP_Comment $comment           The comment object.
	 */
	return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment );
}

更新日志

Version 描述
4.4.0 Added the ability for $comment_ID to also accept a WP_Comment object.
1.5.0 Introduced.

相关函数

Uses

  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/comment-template.php:
    get_comment_author_IP
  • wp-includes/comment.php:
    get_comment()

Used By

  • wp-admin/includes/class-wp-comments-list-table.php:
    WP_Comments_List_Table::column_author()
  • wp-includes/comment-template.php:
    comment_author_IP()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!