Site logo

Archived topic

Static category pages and RSS feed

3 replies · Started by George on March 29, 2022

Viewing posts 1–4 of 4

I am using static category pages with the following code:

add_filter('request', function( array $query_vars ) {
    if ( is_admin() ) {
        return $query_vars;
    }

    if ( isset( $query_vars['category_name'] ) ) {
        $pagename = $query_vars['category_name'];

        $query_vars = array( 'pagename' => "$pagename" );
    }

    return $query_vars;
} );

There is a problem with the RSS feed though. Normally the feed would show with SITEURL/category/feed but it's not the case with static category pages. Need the feed so my client can apply for Google News.

Any solutions?

Hi George,

You may need a third-party plugin to manage RSS feeds as by default the RSS feed matches the current queried object and since this is technically still a static page, the RSS feed is of the static page and not the desired /category/cat-term/feed/.

You'll have to manually add-in the preferred feed(the custom loops) for the static page so it matches what's on the actual page. :D

I see, thanks, Elvin.

No problem. :)

This archived topic is closed to new replies.