Skip to content

Instantly share code, notes, and snippets.

@WerdsWords
Last active December 19, 2015 19:28
Show Gist options
  • Save WerdsWords/6005870 to your computer and use it in GitHub Desktop.
Save WerdsWords/6005870 to your computer and use it in GitHub Desktop.
#1: pre_comment_author_name
<?php
/**
* Filter the comment author name for administrators
*
* @see wp_filter_comment(), sanitize_comment_cookies()
*
* @param string $name The comment author name.
* @return string The filtered author name.
*/
function wpdocs_comment_author_name( $name ) {
if ( current_user_can( 'manage_options' ) )
return sprintf( __('Admin: %s', 'yourtextdomain'), $name );
else
return $name;
}
add_filter( 'pre_comment_author_name', 'wpdocs_comment_author_name' );
@WerdsWords
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment