[wp-hackers] Should Monthly Archive Pages ever return 404?

Mike Little mike at zed1.com
Mon Mar 9 22:08:17 GMT 2009

2009/3/9 Stephen Rider <wp-hackers at striderweb.com>:
> Mike --
> Your argument borders on /reducto ad absurdum/.  Respectfully submitted...
> On Mar 9, 2009, at 4:13 PM, Mike Little wrote:
>> You now have the situation when every possible date-based URI
>> from the year zero onwards is valid, presumably including the ones in
>> the future, forever!
> Not unless you code it that way.  Try this:

But that is what is being suggested: that a date uri for which no
posts exist should be valid - that is return 200

> Anything from the month of the first post, to the present month, has a valid
> "month" archive page.

But why should such an arbitrary 'rule' be *built into* WordPress?
Which is again what has been suggested on this thread.

> You're looking at it from an absolutist coder stance.  I'm looking from the
> end user's POV.  If example.com/blog/2008/06 is a valid archive page, and
> example.com/blog/2008/08 is a valid archive page, then I would expect
> example.com/blog/2008/07 to be valid as well, even if July has no posts.

I would disagree. From a user's point of view, they should expect a
user friendly response. Which might not be the same as 'valid'

One such response is, as I've suggested "what you gave me was invalid,
but here is something that is useful to you." That's human level

Machine level (server to browser)  should either be "I couldn't find
what you asked for. Show this to your human" (404 with content) or "I
couldn't find what you asked for, go here instead" (302)

> I guess my main question is this:  CAN this reasonably be done in a plugin?
>  If it can, without being too grossly complicated, I would probably be fine
> leaving it to a plugin to fix if I wanted it.

The actions I mentioned allow you to do exactly that.

But I still maintain that it is not a fix. Rather, additional
functionality above what WordPress does (and should do).

WordPress says "I cannot find any content for this date based URL" and
then gracefully allows you to provide some alternate content. Other
wise it does what it should do return 404 - no content found.

Remember WordPress only 'does' posts, pages, and links, they are it's
only content.

Mike Little

More information about the wp-hackers mailing list