612-293-8629 [email protected]

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 = '<div class="organization-text"><strong>Organization: ' . $commenter_organization . '</strong></div><!-- .organization-text -->';
		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!


We love to communicate: phone, email, text, Facebook, Twitter, LinkedIn, you name it.



Call Now

Enroll in Our Free Beginner WordPress Class by Email

Never feel powerless in WordPress again!  Become a WordPress superstar for free in only minutes a day!

Our Beginner WordPress Email Class is delivered to your inbox!

Learn More 

You Have Successfully Enrolled! Prepare For Amazing!