Search code examples
phpwordpresstagsrssfeed

Differentiate categories from tags in a Wordpress RSS feed


I have a wordpress blog with an automatic generated rss feed (https://blog.pixelinnova.com/feed), but I can't find a way to differentiate the categories from the tags, they are all between the XML tags <category></category>. For example:

<category><![CDATA[Consultoría tecnológica]]></category>
<category><![CDATA[Marketing digital]]></category>
<category><![CDATA[centennials]]></category>
<category><![CDATA[facebook]]></category>

The two first ones are categories, the others are tags.

Is there a way that I can make them look different in the feed, like changing the tags' "category" XML tag or something?

Example image

The ones marked in yellow are categories. The others are tags.


Solution

  • I found a snippet that makes only categories appear on the feed, I added it to the functions.php on my child theme and it worked:

    add_filter('get_the_tags', 'strip_tags_from_feeds');
    function strip_tags_from_feeds($terms) {
    if (is_feed())
      return array();
      return $terms;
    }