Remove admin name in wordpress comments class

May 25, 2010 · Print This Article

Every time we posted a comment, WordPress automatically added a class that pretty much told everyone our admin login name.

The offending class is the “comment-author-admin” class.

We can created a code snippet that can quickly remove the offending class from every comment.

Just add follow code to your functions.php file:

function remove_comment_author_class( $classes ) {
	foreach( $classes as $key => $class ) {
		if(strstr($class, "comment-author-")) {
			unset( $classes[$key] );
		}
	}
	return $classes;
}
add_filter( 'comment_class' , 'remove_comment_author_class' );

Your choice for site templates and wordpress themes

Comments

Got something to say?

You must be logged in to post a comment.