[Resolved] Static category pages and RSS feed

Home Forums Support [Resolved] Static category pages and RSS feed

Home Forums Support Static category pages and RSS feed

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2171761
    George

    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?

    #2171883
    Elvin
    Staff
    Customer Support

    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. ๐Ÿ˜€

    A wise man once said:
    "Have you cleared your cache?"

    #2172959
    George

    I see, thanks, Elvin.

    #2173129
    Elvin
    Staff
    Customer Support

    No problem. ๐Ÿ™‚

    A wise man once said:
    "Have you cleared your cache?"

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.