The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

Remove post tags from category rss (6 posts)

  1. joshuatuscan
    Posted 5 years ago #

    WordPress automatically includes both tags and categories in the RSS category tag when outputting the RSS2 for the site. I've figured out how to remove tags by deleting the line that includes them in the /wp-includes/feed.php file on line 315, but whenever wordpress is updated, this is reverted back to including tags.

    How would you remove tags from the category RSS using the functions.php?

  2. Mike Little
    Posted 5 years ago #

    As you have realised, modifying core code is never a good idea; and usually unnecessary.

    This is untried, but something like this should work..'

    add_filter('get_the_tags', 'strip_tags_from_feeds');
    function strip_tags_from_feeds($terms) {
        if (is_feed())
          return array();
        return $terms;
  3. joshuatuscan
    Posted 5 years ago #

    Any way I can get a functional example of this code? Unfortunately my PHP skills are still in need of improvement.

  4. Mike Little
    Posted 5 years ago #

    Just tested it, and it will work exactly as I wrote.

    Add that code to functions.php in your theme and the tags will not be included in the RSS feeds.

  5. joshuatuscan
    Posted 5 years ago #

    Thanks so much, been looking forever for this solution.

  6. iPollesion
    Posted 4 years ago #

    Thanks Mike, I was looking for this too.

Topic Closed

This topic has been closed to new replies.

About this Topic