Category "Older Entries" 404 Error (3 posts)

  1. nyfael
    Posted 7 years ago #


    So I've googled and searched through this forum for this problem, and found many people with it, but no one with an answer, or the people who did solve it had created it a different way.

    The problem is that in the blog archive page for each category, when clicking on "Older Entries", I receive a 404 Error.

    Well, I figured out how to fix this, but it will then break the rest of the blog (can't get to any posts, tags, etc.)

    The fix is on line 390 of wp-includes/rewrite.php (that line may change as I may have bumped it up/down a few lines).

    That line basically says if you don't specify a category base, make the category base "/category/" instead of "/" which is what I specified in my permalink structure (this is a bug).

    You can not make it "/", so my solution was to remove the "category/" so it was in fact what I wanted.

    This causes the break, probably due to the function generate_rewrite_rules on line 510 or so. This takes the permalink structure, and if I'm correct, calls out the rewrite rule from the DB. It gets pretty friggin complicated as its serialized in the DB. I think its the calling of the rewrite rule that breaks when you do the change I noted above.

    So, for now, I've left everything as it was, and given myself a category base and all works well, but I really DON'T want this category base.

    Does anyone have any idea? I'm completely willing to work for it, I've been working on this problem for hours and I've driven myself a little crazy.


  2. devwhatev
    Posted 7 years ago #

    I've been looking for the same info. I've decided that, if it's going to be too much trouble, then I'm O.K. with the 'Category Base'.

    But what really bothers me about that way is if you request the category base it throws a 404 error. (e.g. mysite.com/category/ = 404 Error)

    Right now I'm looking for a way to hack the theme or a plugin that will replace the category base page with either a list of categories or a sitemap or something like that. Anything but a 404. That's just not cool, man.

    I haven't really explored much deeper into the WordPress code base beyond installing version 2.5 this morning and running a few pages through my PHP debugger on my local development server, but I'm thinking there should be a reasonably practical solution to this /category-base/ 404 issue.

    Here are some plugins I have in my research list:

    1. Category Base Removal Plugin
      For removing the category base completely.
    2. Top Level Categories
      Allows you to remove the prefix before the URL to your category page.

    Not sure if either of these are 2.5 compatible or if they cause further issues with the rest of the permalink substructure. I'll know more tonight.

    Good luck, though. I'll post again when I find a solution.

  3. qweenie
    Posted 7 years ago #

    @ echo

    I had previously used the Top Level Cats plugin but after the upgrade to 2.5 I started getting this warning on the page when displaying a 404.

    Warning: Invalid argument supplied for foreach() in /wp-includes/query.php on line 683

    Removing the plugin got rid of the warning. I've been using the Category Base Removal Plugin for a few days with no problems.

    If you want to get rid of the 404 for your custom category base create a category with the same slug as your custom category base, make it the parent of all your other cats, and design a custom template for it in your theme.

Topic Closed

This topic has been closed to new replies.

About this Topic