DigitalOrgano

  • Home
  • About
  • Categories
    • Windows OS
    • Software
    • Android
    • Technology
  • Contact
DigitalOrgano » WordPress » Remove Author Username From Comment Class In WordPress

Remove Author Username From Comment Class In WordPress

Last updated on June 22, 2020 by Editorial Staff Under WordPress

Tweet
Share
Share
Pin

One of the security hole that is found in WordPress is that whenever admin comment or editor comment on any of the blog post, WordPress automatically add a class to the comment along with the username. So if you right click on any of the admin comment, you will find the username in the class.

Author Username In Comment Class

This is not bad for styling, but for security reason this is not good. To remove username from comment class add the following to your theme function.php or add it to a site specific plugin.

//remove site author from comment css
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');

Hope that this article helped you to remove the author name from the comment class.

Source: Bavotasan

« Offline Updater For Kaspersky
Download UC Browser For PC »

Join The Discussion

  1. Jordan

    April 14, 2018 at 9:42 pm

    Dude, I was looking for this specific code for ages. You rock

Our Social Links

  • facebook
  • instagram
  • feedburner

Latest Articles

  • Create Shortcut For Any Program Or Folder In My Computer
  • The Best Way To Post Story On Instagram Using PC
  • Download Latest Google Chrome Offline Installer
  • 5 Best Ways to Free Up Drive Space on Windows 10
  • How to Enable Dark Mode in Microsoft Office
  • How to Properly Restore Windows Registry in Windows 10
Copyright © 2025 DigitalOrgano