Support » Plugins » Hacks » Filter to add content to post, but not feed

  • Resolved ruudkok


    Inspired on the WordCamp NL last weekend I started playing around writing a little plugin of my own.

    I use this code to add a bit of text to the bottom of each post:

    function add_some_tekst_of_mine($content)
    $content .= ‘Add this line’;
    return $content;


    However, I ran into a little problem, since the added line also returns in the RSS feed.
    Since I don’t want that to happen, how can I make sure that the function will not be applied to the feed and only to the postings on the website?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Add a condition to it?

    if (!is_feed())
    	$content .= 'Add this line';

    It seems to me, that in this case you don’t need an argument for the function. So unless you plan to do more complicated things, I guess you could accomplish the same this way:

    function add_some_tekst_of_mine() {
     if (!is_feed()) {
      echo 'Add this line';

    Thank you! The (!is_feed()) conditions seems to do the job.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Filter to add content to post, but not feed’ is closed to new replies.