get_comment_ID
Filter HookDescription
Filters the returned comment ID.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 741 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$comment_id
|
The current comment ID as a numeric string. |
WP_Comment
|
$comment
|
The comment object. |
Usage Examples
Basic Usage
<?php
// Hook into get_comment_ID
add_filter('get_comment_ID', 'my_custom_filter', 10, 2);
function my_custom_filter($comment_id, $comment) {
// Your custom filtering logic here
return $comment_id;
}
Source Code Context
wp-includes/comment-template.php:741
- How this hook is used in WordPress core
<?php
736 * @since 4.1.0 The `$comment` parameter was added.
737 *
738 * @param string $comment_id The current comment ID as a numeric string.
739 * @param WP_Comment $comment The comment object.
740 */
741 return apply_filters( 'get_comment_ID', $comment_id, $comment ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.NotLowercase
742 }
743
744 /**
745 * Displays the comment ID of the current comment.
746 *
PHP Documentation
<?php
/**
* Filters the returned comment ID.
*
* @since 1.5.0
* @since 4.1.0 The `$comment` parameter was added.
*
* @param string $comment_id The current comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/comment-template.php
Related Hooks
Related hooks will be displayed here in future updates.