Is possible to include a column for comment_id?
Yes, and there are two hooks that you'd want to use:
Working example you can try:
// Add the comment ID column.
add_filter( 'manage_edit-comments_columns', function ( $columns ) {
$columns['comment_id'] = 'ID';
return $columns;
} );
// Display the content of the above column.
add_action( 'manage_comments_custom_column', function ( $column_name, $comment_ID ) {
if ( 'comment_id' === $column_name ) {
echo $comment_ID;
}
}, 10, 2 );
Additionally, if I were you, I'd probably want to make the comment ID column be sortable (so that the comments list can be sorted by clicking on the "ID" column in the table header/footer), and for that, you can use the manage_edit-comments_sortable_columns
hook to add the column to the sortable columns list:
add_filter( 'manage_edit-comments_sortable_columns', function ( $columns ) {
$columns['comment_id'] = 'comment_id';
return $columns;
} );
Note that the comment_id
doesn't need extra coding to make the comments sorting works, so you could simply add the column to the sortable columns list — for other custom columns, you may need to write the code for sorting the comments based on the specific custom column.