Forums

[resolved] Problem with adding filter (2 posts)

  1. MattGeri
    Member
    Posted 4 years ago #

    Hey Guys and Gals.

    I just wrote a little piece of code that adds nofollow tags to my WP posts. Here is the code:


    <?php
    function addnofollow($text) {
    return str_replace('<a href=', '<a rel="nofollow" href=', $text);
    }
    add_filter('the_content', 'addnofollow');
    ?>

    Now it all works very well except when I try to view my RSS feed. I get the following error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/cfml/public_html/wp-content/plugins/addnofollow.php:12) in /home/cfml/public_html/wp-includes/feed-rss2.php on line 2

    Any ideas what is causing this?

  2. MattGeri
    Member
    Posted 4 years ago #

    Oops. Silly old me! I had whitespace after the closing php tag. Problem fixed! Thanks!!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.