Created
September 12, 2017 10:04
-
-
Save bewho/d6b1e91de36e690c8e456efe8c4c1369 to your computer and use it in GitHub Desktop.
Add nofollow attribute to category specific links
This file contains hidden or 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
//Adding this snippet to the functions.php of your wordpress theme will add the nofollow attribute to category specific links within the_content. | |
function nofollow_cat_posts($text) { | |
global $post; | |
if( in_category(1) ) { // SET CATEGORY ID HERE | |
$text = stripslashes(wp_rel_nofollow($text)); | |
} | |
return $text; | |
} | |
add_filter('the_content', 'nofollow_cat_posts'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment