get_comment_time
Filter HookDescription
Filters the returned comment time.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1135 |
Hook Parameters
Type | Name | Description |
---|---|---|
string|int
|
$comment_time
|
The comment time, formatted as a date string or Unix timestamp. |
string
|
$format
|
PHP date format. |
bool
|
$gmt
|
Whether the GMT date is in use. |
bool
|
$translate
|
Whether the time is translated. |
WP_Comment
|
$comment
|
The comment object. |
Usage Examples
Basic Usage
<?php
// Hook into get_comment_time
add_filter('get_comment_time', 'my_custom_filter', 10, 5);
function my_custom_filter($comment_time, $format, $gmt, $translate, $comment) {
// Your custom filtering logic here
return $comment_time;
}
Source Code Context
wp-includes/comment-template.php:1135
- How this hook is used in WordPress core
<?php
1130 * @param string $format PHP date format.
1131 * @param bool $gmt Whether the GMT date is in use.
1132 * @param bool $translate Whether the time is translated.
1133 * @param WP_Comment $comment The comment object.
1134 */
1135 return apply_filters( 'get_comment_time', $comment_time, $format, $gmt, $translate, $comment );
1136 }
1137
1138 /**
1139 * Displays the comment time of the current comment.
1140 *
PHP Documentation
<?php
/**
* Filters the returned comment time.
*
* @since 1.5.0
*
* @param string|int $comment_time The comment time, formatted as a date string or Unix timestamp.
* @param string $format PHP date format.
* @param bool $gmt Whether the GMT date is in use.
* @param bool $translate Whether the time is translated.
* @param WP_Comment $comment The comment object.
*/
Quick Info
- Hook Type: Filter
- Parameters: 5
- File: wp-includes/comment-template.php
Related Hooks
Related hooks will be displayed here in future updates.