get_comment_type() WP 1.0
Retrieve the comment type of the current comment.
Basis of: comment_type()
1 time = 0.000483s = fast | 50000 times = 0.13s = very fast | PHP 7.0.32, WP 5.1
Hooks from the function
Return
String. The comment type.
Usage
get_comment_type( $comment_ID );
- $comment_ID(int/WP_Comment)
- WP_Comment or ID of the comment for which to get the type.
Default: current comment
Changelog
Since 1.5.0 | Introduced. |
Since 4.4.0 | Added the ability for $comment_ID to also accept a WP_Comment object. |
Code of get_comment_type() get comment type WP 5.6
function get_comment_type( $comment_ID = 0 ) {
$comment = get_comment( $comment_ID );
if ( '' === $comment->comment_type ) {
$comment->comment_type = 'comment';
}
/**
* Filters the returned comment type.
*
* @since 1.5.0
* @since 4.1.0 The `$comment_ID` and `$comment` parameters were added.
*
* @param string $comment_type The type of comment, such as 'comment', 'pingback', or 'trackback'.
* @param int $comment_ID The comment ID.
* @param WP_Comment $comment The comment object.
*/
return apply_filters( 'get_comment_type', $comment->comment_type, $comment->comment_ID, $comment );
}Related Functions
From category: Comments
- cancel_comment_reply_link()
- comment_author_email_link()
- comment_form()
- comment_form_title()
- comment_id_fields()
- comment_text()
- comment_type()
- comments_link()
- comments_number()
- comments_popup_link()
- get_avatar()
- get_avatar_data()
- get_avatar_url()
- get_cancel_comment_reply_link()
- get_comment()
- get_comment_author_email()
- get_comment_pages_count()
- get_comment_reply_link()
- get_comment_text()
- get_comments()
- get_comments_link()
- get_comments_number()
- get_comments_pagenum_link()
- get_edit_comment_link()
- get_next_comments_link()
- get_page_of_comment()
- get_previous_comments_link()
- get_the_comments_navigation()
- get_the_comments_pagination()
- is_comment_feed()
- is_trackback()
- next_comments_link()
- paginate_comments_links()
- previous_comments_link()
- sanitize_comment_cookies()
- the_comments_navigation()
- the_comments_pagination()
- wp_allow_comment()
- wp_count_comments()
- wp_delete_comment()
- wp_get_current_commenter()
- wp_handle_comment_submission()
- wp_insert_comment()
- wp_list_comments()
- wp_new_comment()
- wp_notify_moderator()
- wp_notify_postauthor()
- wp_set_comment_cookies()
- wp_set_comment_status()
- wp_spam_comment()
- wp_transition_comment_status()
- wp_update_comment()
- wp_update_comment_count()