• Resolved _td

    (@_td)


    Either that, or they just show the blog page, rendered in the template and not the RSS feed. Here’s what’s going on:

    Main site:
    https://blog.gethope.net

    https://blog.gethope.net/feed
    – This is my main feed, works great

    I have a category called “Stewardship”, so that category feed should be:
    https://blog.gethope.net/stewardship/feed
    – This just brings me to the fully rendered category archive page for Stewardship. Not an RSS feed

    I also tried (which I figured wouldn’t work, but just for grins):
    https://blog.gethope.net/feed?cat=stewardship
    – This redirects to my main feed

    I also tried (which, according to the docs, SHOULD work):
    https://blog.gethope.net/feed?cat=801 (the ID of the “Stewardship” category)
    – This just redirects to my main blog page

    I have a feeling it’s something to do with my .htaccess, but I’m not sure what. Here’s what’s in there (which I thought was the default WordPress stuff)

    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress

    I AM using a custom permalink structure. That structure is:
    /%year%/%postname%

    – but I didn’t think that would affect the category. So I’m not sure which one (either the permalinks or the .htaccess) is messing up the category feed

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter _td

    (@_td)

    I think I may have figured it out! It seems like it’s this function here (which I had almost forgotten I had put in):

    function load_cat_parent_template()
    {
        global $wp_query;
    
        if (!$wp_query->is_category)
            return true; // saves a bit of nesting
    
        // get current category object
        $cat = $wp_query->get_queried_object();
    
        // trace back the parent hierarchy and locate a template
        while ($cat && !is_wp_error($cat)) {
            $template = TEMPLATEPATH . "/category-{$cat->slug}.php";
    
            if (file_exists($template)) {
                load_template($template);
                exit;
            }
    
            $cat = $cat->parent ? get_category($cat->parent) : false;
        }
    }
    
    add_action('template_redirect', 'load_cat_parent_template');

    It turns out that when an RSS feed is loading, it uses the “template_redirect” function so for the feed it was causing it to use the category template I had made for this category instead of the default WordPress RSS feed template.

    Now, I’m not quite sure how to fix it. Since I want all sub-categories to use the main category template, is there another way to do this?

    Thread Starter _td

    (@_td)

    Figured it out! Just wrap this whole function in a is_feed, if statement. That way I can keep the category/sub-category functionality for when you’re viewing the blog, but otherwise it uses the RSS feed template.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘My category RSS feeds are redirecting to my main RSS feed’ is closed to new replies.