Last active
October 30, 2023 07:50
-
-
Save SiR-DanieL/e91f6ddc111f2e5fd8b25231993fbabf to your computer and use it in GitHub Desktop.
Remove the "nofollow" From the Recent Comments
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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