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

Mike Schinkel mikeschinkel at newclarity.net
Mon Mar 9 19:23:11 GMT 2009

"Casey Bisson" <casey.bisson at gmail.com> wrote:
> Are you arguing that the page shouldn't return a 404, or 
> that WP should implement some more elegant hooks to handle 
> 404 conditions?

The former is admittedly a long debate that would probably never be resolved to everyone's satisfaction and with significant bikeshedding.

So the latter is probably the best approach.

> You should take a look inside the WP_Query object. It's 
> written to parse every possible legal request URL, and 
> if you hook into in the right places, you'll also find 
> opportunities to generate more useful 404s when either 
> the query parser fails or if the database returns no  
> results (as is the case with your example).

Thanks. I've review it but will give it another look.  

That said, a question; does it allow me to say "Don't generate a 404, just continue on and run the archive page as you would for any month where there are posts?"  Otherwise I'll likely have to write some very convoluted code to get the results I'm looking for.  And if it doesn't I'll happily write the patch to improve it is someone can suggest what branch of code to patch?

-Mike Schinkel

More information about the wp-hackers mailing list