• Resolved aBigHairySpider

    (@abighairyspider)


    I was having a problem with an Older Entries link bringing up a 404 when there were actually older entries in the category.

    The permalink was something like:

    http://site.com/category/category-name/page/2/

    I had to modify the WP class handle_404() member (wp-includes/classes.php) as follows:

    if ( ( is_tag() || is_category() || is_tax() || is_author() ) && $wp_query->get_queried_object() /* && !is_paged() */ )

    That “!is_paged()” didn’t make any sense to me, so I commented it out and now everything works great.

    Of course I’m looking for a paged result!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • Don’t edit core files!

    Thread Starter aBigHairySpider

    (@abighairyspider)

    In this case, the core file had a bug.

    There’s no bug report…

    It’s far more likely that your custom query was at fault.

    Thread Starter aBigHairySpider

    (@abighairyspider)

    That’s not a custom query. It’s a simple category query for the second page.

    The 404 handler is in error deciding to display a 404 when (a) there was a result, and (b) the user expects any page but the first. So, if paged= ended up in the query string, it decided the information it found wasn’t worth displaying.

    It’s a bug, sorry.

    If this was a bug, it would have affect tens of thousands (if not millions) of sites. So how come it’s only happening on your site(s)?

    Thread Starter aBigHairySpider

    (@abighairyspider)

    Yours is certainly a logical line of thinking, but the code as installed with 3.0.4 on this site definitely makes no sense.

    A quick search brings up lots of complaints in the last year alone about 404’s that sound similar along with intricate stories of how people got things to work. Perhaps under certain conditions the “paged” query value is filtered out, and the 404 handler expects that to have happened, but I didn’t find any evidence of any attempts to do such a thing.

    The whole idea of: “Hey, I found a category as asked,” and: “If someone is looking for a specific page then puke,” seems, on the surface, a silly one.

    But, I’m not suggesting anyone change anything — I just posted this in case someone is stuck.

    Thread Starter aBigHairySpider

    (@abighairyspider)

    And, after thinking for 10 more seconds, I don’t believe it could be intended for the paged value to be removed because templates need it to present the proper links for Older and Newer posts.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘404 Error on Paged Queries’ is closed to new replies.