get_comment_author_IP
Filter HookDescription
Filters the comment author's returned IP address.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 332 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_author_ip
|
The comment author's IP address, or an empty string if it's not available. |
string
|
$comment_id
|
The comment ID as a numeric string. |
WP_Comment
|
$comment
|
The comment object. |
Usage Examples
Basic Usage
<?php
// Hook into get_comment_author_IP
add_filter('get_comment_author_IP', 'my_custom_filter', 10, 3);
function my_custom_filter($comment_author_ip, $comment_id, $comment) {
// Your custom filtering logic here
return $comment_author_ip;
}
Source Code Context
wp-includes/comment-template.php:332
- How this hook is used in WordPress core
<?php
327 *
328 * @param string $comment_author_ip The comment author's IP address, or an empty string if it's not available.
329 * @param string $comment_id The comment ID as a numeric string.
330 * @param WP_Comment $comment The comment object.
331 */
332 return apply_filters( 'get_comment_author_IP', $comment->comment_author_IP, $comment->comment_ID, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
333 }
334
335 /**
336 * Displays the IP address of the author of the current comment.
337 *
PHP Documentation
<?php
/**
* 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.
*/
Quick Info
- Hook Type: Filter
- Parameters: 3
- File: wp-includes/comment-template.php
Related Hooks
Related hooks will be displayed here in future updates.