FAQ

Frequently Asked Questions

How to add nofollow attributes to all links in a specific category – CodeRevolution

Sometimes you may want to have an entire category of your blog with nofollow links, for exemple if you’re linking to a lot of external resources. Here is a quick and easy recipe to do so. Enjoy!

Simply copy the code below and paste it on your functions.php file. Don’t forget to set the desired category ID on line 3.

 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'); 

Thanks to Sagive for submitting this function!

CodeRevolution Knowledge Base

Video tutorials