How to add nofollow on all external links without plugin?

This is how I would do it :

1/ create a filter to access the post content before it’s displayed on page.
See http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content

2/ Inside your fonction called (ie : my_the_content_filter in the example from the Codex)
adapt this code :
https://stackoverflow.com/questions/5037592/how-to-add-rel-nofollow-to-links-with-preg-replace

Cheers !

Leave a Comment