#5324 closed defect (bug) (fixed)
404 error on empty category page
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.7 | Priority: | normal |
Severity: | normal | Version: | 2.5 |
Component: | General | Keywords: | has-patch dev-feedback |
Focuses: | Cc: |
Description
spoken to many people who believe this isn't good functionality and probably a bug. i'm not a coder so I might be wrong, but i hope not.
wordpress returns a 404 error when a category page is viewed that's empty.
Attachments (5)
Change History (41)
#2
follow-up:
↓ 4
@
17 years ago
Question...
Does this occur only when you manually construct the URL itself, or is WordPress automatically generating a link to the page for the empty category which results in a 404?
#3
@
17 years ago
- Keywords has-patch added; needs-patch removed
- Owner changed from anonymous to pishmishy
- Status changed from new to assigned
Sorry, ignore that file. It's not complete.
#4
in reply to:
↑ 2
@
17 years ago
Replying to pishmishy:
Question...
Does this occur only when you manually construct the URL itself, or is WordPress automatically generating a link to the page for the empty category which results in a 404?
Well, it's the same URL, so... ;)
#5
@
17 years ago
- Owner changed from pishmishy to anonymous
- Status changed from assigned to new
Actually I think this one is beyond me to fix cleanly.
#7
@
17 years ago
Patch attached. Fixes WP::handle_404() to ensure that emoty archives are not treated as 404 and instead serves a 200 allowing the Loop to take over.
#8
@
17 years ago
- Keywords has-patch added; needs-patch removed
- Owner changed from anonymous to technosailor
- Status changed from new to assigned
#10
@
17 years ago
- Milestone changed from 2.9 to 2.7
hopefully, one of the devs can look at this and maybe get it in.
#11
@
17 years ago
My only concern is that some templates assume that there are posts when there is not a 404. I think that's probably a small number of templates, however. The patch seems worth a shot for 2.7.
#12
@
17 years ago
On my first few test, the latest patch seems to be working perfectly. I'd REALLY like to see this in 2.7.
#13
@
17 years ago
I applied the patch by technosailor to my 2.6.1 install and it's working great. I'd still like to see this submitted to trunk. What do we still need to do to make that happen?
#15
@
17 years ago
For taxonomy and author queries, shouldn't we be checking to see if the queried object is empty and 404 if so.
#16
@
17 years ago
I've always been frustrated by this bug. The page should exist, and say there are no articles by that author (etc). It shouldn't return a 404!
Get it into trunk!!!
#17
@
17 years ago
Here's a version that makes sure the various archive queries matched an object. If not, 404.
#18
@
17 years ago
Um... What's an object? If I visit the page http://www.example.com/author/fred/, but author Fred hasn't yet written anything, does your patch stop the 404 from being returned? If so, what is returned?
#19
@
17 years ago
If the user Fred doesn't exist, we should 404. If he does exist but has not written anything, we should not 404.
#20
@
17 years ago
Ryan: That's working better. It 404 for things like invalid categories, but not for empty categories.
#22
follow-up:
↓ 23
@
17 years ago
It still doesn't look quite right to me - Now instead of a 404 you get "Not found", which doesn't really seem any better from the viewer's perspective. "Not found" does not really explain the situation - does it mean "author not found" or "no posts found", etc..
If the author exists (with posts), you get a page heading of "Author Archive" (with posts below.). It seems that if the author exists (without posts) it should still say "Author Archive" and simply not list any posts, rather than saying "Not found".
(This may be a templating issue which distincts it from the coding issue, I suppose, in which case it needs a change to the behaviour of the default template.)
#23
in reply to:
↑ 22
@
17 years ago
Replying to mrmist:
Yes, I absolutely agree. Basically the only change so far is the error code, which whilst it is an improvement hardly affects the visitor. The solution isn't very user-friendly solution yet.
Yes, it may be a templating issue. I can't remember. But if it is then, as you say, it should be changed in the default template.
+1 for "Author Archive" heading with no posts. Perhaps a message below saying "there are no posts by this author", or similar.
#24
@
17 years ago
See also #3345. There are some patches for this issue there, though I haven't looked at them...
#26
@
17 years ago
OK; I'll make a patch for the default template.
I don't think a 404 should be returned for date archives with no posts either, this should be fixed in the same way.
#27
@
17 years ago
Oh sorry, I've jut realised that diff contains some other fixes as well (tidying up the page title)...
I'll clean it up later or tomorrow and try again, but have a look at the relevant part anyway!
#29
@
17 years ago
If you have a comment to make regarding a fix for this issue, or your need for a fix, please make it, but please don't 'bump' tickets. The lack of action is not because we aren't aware of the ticket's existence.
#30
@
17 years ago
That's fair. I should have asked my question rather than bumping the topic. Where do we stand on this? I've been using the patch successfully for quite a while now, on a few different sites. I think we're just waiting on the default theme to be updated to handle this? If this is the case I'll update that and upload a patch.
#32
@
17 years ago
Am I mistaken, or did we add the changes to archive.php but not make technosailor's changes to classes.php that made it necessary?
#33
@
17 years ago
Am I mistaken, or did we add the changes to archive.php but not make technosailor's changes to classes.php that made it necessary?
There was this comment furthur up that touched classes.php, not sure if its the one you're after though..
08/28/08 19:58:57 changed by ryan
(In [8761]) Don't 404 for categories, tags, and authors that exist but have no posts. see #5324
Confirmed on trunk. Displays the error 404 page and sends a 404 header for the archive view of an empty but existing category.
It should display as normal and when the template check for
have_posts()
or whatever fails, the "no matching posts" error will be shown.