Created
September 12, 2013 17:39
-
-
Save cliffordp/6541209 to your computer and use it in GitHub Desktop.
From http://wpsnipp.com/index.php/cat/add-nofollow-attribute-to-category-specific-links/
Uses http://codex.wordpress.org/Function_Reference/wp_rel_nofollow
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 | |
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