Are you looking for a way to display a signature after each admin comment? While there’s probably a plugin for this, we have created a quick code snippet that you can use to automatically add a signature to admin comments in WordPress.
You may need to update the ID number, the default is set to ‘1’ and of course change the text displayed within the signature.
Instructions:
All you have to do is add this code to your theme’s functions.php file or in a site-specific plugin:
add_filter( 'comment_text', 'my_comment_text' ); function my_comment_text( $mytext ) { $id = get_comment(get_comment_ID())->user_id; global $comment; if($id == 1 ){ $mytext = get_comment_text( $comment ) . '<hr />Test comment text!'; }else{ $mytext = get_comment_text( $comment ); } return $mytext; }
Note: If this is your first time adding code snippets in WordPress, then please refer to our guide on how to properly copy / paste code snippets in WordPress, so you don’t accidentally break your site.
If you liked this code snippet, please consider checking out our other articles on the site like: 6 best image optimization plugins for WordPress and how to track affiliate links in Google Analytics.
Doesn’t work, bro. Displays signature for ALL comment authors… not just admins.
Hi Ttomp,
Your right was not sure what I was up to that day lol, anyway I updated the snippet and it is working properly now.
Is possible, for any way, add the boton Twitter