Adding Custom Comment Meta to the WordPress Admin

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!

The Mighty Mo! Design Co.

More posts from themightymo.com

How to merge two folders, including all sub-folders and files, on Mac

By The Mighty Mo! Design Co. | November 3, 2022

Today I had an issue where I needed to merge two folders, each of which contained many sub- and sub-sub folders that had lots of images. After a lot of trial-and-error and some Googling, I found the best solution is to use the “ditto” command in Terminal like this: That’s it! Hat tip to AppleInsider.

mailchimp usage stats

Some Surprising Trends in Website Development

By Toby Cryns | October 17, 2022

I wasted some time today to bring you (dum dum duuuuum!): Some Surprising Trends in Website Development!

How to Configure WordPress with Cloudflare, HSTS, TLS, and Secure Headers

By The Mighty Mo! Design Co. | October 11, 2022

I was recently asked to look into creating some secure http headers as well as forcing a website to load over TLS1.2+. Below are my “how to” instructions for updating these settings within WordPress and Cloudflare. Install & Configure the Cloudflare WordPress plugin. Make sure an SSL Certificate is installed on your host for your…