WordPress.org

Forums

the_category_rss and get_the_category_rss return tags as well as categories (1 post)

  1. gilzow
    Member
    Posted 1 year ago #

    I'm writing some custom feeds and discovered that when using
    the_category_rss or get_the_category_rss the functions are returning not only the category(ies) for the post but also the tags. In looking at the documentation for these functions, they both state that they return the category(ies) with no mention of returning the tags. However, in looking at /wp-includes/feed.php at line 304, it does gather the tags via get_the_tags() and then at line 317 adds them to the $cat_name array. Even the internal documentation doesn't mention anything about throwing tags into the list of categories.

    I'm assuming this isn't a bug since it appears to have been like this all the way back to 2.1. Though the function name and the documentation are confusing.

    Also, there isn't a filter that can be applied after the list has been generated and before the items are formatted. Only one at the very end at the point of return. So it doesn't appear that there is any real way of modifying this behavior short of hooking the the_category_rss filter, loading the list as an XML Object, looping through the nodes and removing those nodes that match a tag name. Seems highly inefficient.

    Any suggestions on how to modify the core behavior of this function that I'm overlooking?

Topic Closed

This topic has been closed to new replies.

About this Topic