Yesterday I showed you how I added a new textfield to my WordPress comments. Toay I will show you how I displayed that data in both the “comments” panel in the admin as well as the comment listing on the front end.

The solution was to create a filter for the comment text and simply prepend my new data to the normal comment output.

(FYI, “organization” in the code below refers to the textfield we created yesterday.)

function ufmn_add_organization_to_comment_admin ( $comment_text ) {
	$commenter_organization = get_comment_meta( get_comment_ID(), "organization", true);
	if ( $commenter_organization ) {
		$ufmn_organization_text = '
Organization: ' . $commenter_organization . '
'; return $ufmn_organization_text . $comment_text; } else { return $comment_text; } } add_filter( 'comment_text', 'ufmn_add_organization_to_comment_admin' );

Many thanks to WPTavern for the code above!