The admin_comment_types_dropdown WordPress PHP filter allows you to modify the comment types shown in the drop-down menu on the Comments list table.
Usage
add_filter('admin_comment_types_dropdown', 'your_function_name'); function your_function_name($comment_types) { // your custom code here return $comment_types; }
Parameters
$comment_types
(string[]): An array of comment type labels keyed by their name.
More information
See WordPress Developer Resources: admin_comment_types_dropdown
Examples
Add a custom comment type to the drop-down menu
To add a custom comment type called ‘feedback’ to the drop-down menu:
add_filter('admin_comment_types_dropdown', 'add_feedback_comment_type'); function add_feedback_comment_type($comment_types) { $comment_types['feedback'] = __('Feedback', 'textdomain'); return $comment_types; }
Remove a specific comment type from the drop-down menu
To remove the ‘pingback’ comment type from the drop-down menu:
add_filter('admin_comment_types_dropdown', 'remove_pingback_comment_type'); function remove_pingback_comment_type($comment_types) { unset($comment_types['pingback']); return $comment_types; }
Rename an existing comment type in the drop-down menu
To change the label of the ‘trackback’ comment type to ‘Referral’:
add_filter('admin_comment_types_dropdown', 'rename_trackback_comment_type'); function rename_trackback_comment_type($comment_types) { $comment_types['trackback'] = __('Referral', 'textdomain'); return $comment_types; }
Reorder comment types in the drop-down menu
To reorder comment types so that ‘trackback’ appears first:
add_filter('admin_comment_types_dropdown', 'reorder_comment_types'); function reorder_comment_types($comment_types) { $trackback = $comment_types['trackback']; unset($comment_types['trackback']); $comment_types = array('trackback' => $trackback) + $comment_types; return $comment_types; }
Add a comment type only for a specific user role
To add a ‘moderator_note’ comment type only for users with the ‘editor’ role:
add_filter('admin_comment_types_dropdown', 'add_moderator_note_for_editors'); function add_moderator_note_for_editors($comment_types) { if (current_user_can('editor')) { $comment_types['moderator_note'] = __('Moderator Note', 'textdomain'); } return $comment_types; }