get_comment_type
Filters the returned comment type.
Использование
add_filter( 'get_comment_type', 'wp_kama_get_comment_type_filter', 10, 3 );
/**
* Function for `get_comment_type` filter-hook.
*
* @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
* @param string $comment_id The comment ID as a numeric string.
* @param WP_Comment $comment The comment object.
*
* @return string
*/
function wp_kama_get_comment_type_filter( $comment_type, $comment_id, $comment ){
// filter...
return $comment_type;
}
- $comment_type(строка)
- The type of comment, such as 'comment', 'pingback', or 'trackback'.
- $comment_id(строка)
- The comment ID as a numeric string.
- $comment(WP_Comment)
- The comment object.
Список изменений
| С версии 1.5.0 | Введена. |
| С версии 4.1.0 | The $comment_id and $comment parameters were added. |
Где вызывается хук
get_comment_type
wp-includes/comment-template.php 1175
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );