Add ID and Parent Comment ID Columns to the Comments Table in /wp-admin

My task was to add two columns to the wp-admin/edit-comments.php page – with comment ID itself and its parent comment ID. Something like this:

Comment ID and Parent Comment ID columns. I will also show you how to customize their width.
Actually you can add these columns anywhere you want – maybe before the Author column or maybe at the end.

add_filter( 'manage_edit-comments_columns', 'rudr_add_comments_columns' );

function rudr_add_comments_columns( $my_cols ){
	// $my_cols is the array of all column IDs and labels
	// if you know arrays, you can add, remove or change column order with no problems
	// like this:
	$my_cols = array(
		'cb' => '', // do not forget about the CheckBox
		'author' => 'Author',
		'comment' => 'Comment',
		'm_comment_id' => 'ID', // added 
		'm_parent_id' => 'Parent ID', // added
		'response' => 'In reply to',
		'date' => 'Date'
	// but the above way is not so good - there could be problems when plugins would like to hook the comment columns
	// so, better like this:
	$misha_columns = array(
		'm_comment_id' => 'ID',
		'm_parent_id' => 'Parent ID'
	$my_cols = array_slice( $my_cols, 0, 3, true ) + $misha_columns + array_slice( $my_cols, 3, NULL, true );

	// if you want to remove a column, you can just use:
	// unset( $my_cols['response'] );

	// return the result
	return $my_cols;

add_action( 'manage_comments_custom_column', 'rudr_add_comment_columns_content', 10, 2 );

function rudr_add_comment_columns_content( $column, $comment_ID ) {
	global $comment;
	switch ( $column ) :
		case 'm_comment_id' : {
			echo $comment_ID; // or echo $comment->comment_ID;
		case 'm_parent_id' : {
			// try to print_r( $comment ); to see more comment information
			echo $comment->comment_parent; // this will be printed inside the column

Let me suppose that your newly created comment columns are too wide, so this small piece of code should help:

add_action( 'admin_head', 'rudr_columns_too_wide' );

function rudr_columns_too_wide(){
	echo '';

P.S. Yes, everything should be added to functions.php.

Misha Rudrastyh

Misha Rudrastyh

I develop websites since 2008, so it is total of 13 years of experience, oh my gosh. Most of all I love love love to create websites with WordPress and Gutenberg, some ideas and thoughts I share throughout my blog.

Need some developer help? Contact me