Skip to content

Instantly share code, notes, and snippets.

@SiR-DanieL
Last active October 30, 2023 07:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SiR-DanieL/e91f6ddc111f2e5fd8b25231993fbabf to your computer and use it in GitHub Desktop.
Save SiR-DanieL/e91f6ddc111f2e5fd8b25231993fbabf to your computer and use it in GitHub Desktop.
Remove the "nofollow" From the Recent Comments
<?php
/**
* Remove the "nofollow" attribute from all comments author's links
* except for a specific author.
*/
function dofollow_blog_author_comment( $return, $author ) {
if ( $author === 'Your Name' ) {
$return = str_replace( "rel='external nofollow ugc'", '', $return );
}
return $return;
}
add_filter( 'get_comment_author_link', 'dofollow_blog_author_comment', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment