[wp-hackers] No posts in a category gives me error 404

Knut-Olav Hoven hovenko at linpro.no
Thu Mar 15 09:57:09 GMT 2007


Using WordPress 2.1.2

Where can I force WordPress to use the template file category.php even if 
there are no posts?


I have a category named "announcement" and it lists out my posts. I have a 
filter activated that filters posts based on some criterea the users can set 
(think of it as tags).

I made a category.php file that adds some text and links at the top if the 
category name is "announcement", but here is my problem: When no posts match 
after adding the filter, Wordpress returns an 404 page, not the 
category-page. This is _very_ confusing for my users.


I find the category subsystem in WordPress very hard to work with, since I 
sometimes need to find a category based on its name, not the ID number. 
Because of this i can not use a file called category-<ID>.php, since the ID 
may change depending on the installation.



-- 
Knut-Olav Hoven
Systemutvikler               mob: +47 986 71 700
Linpro AS                    http://www.linpro.no/


More information about the wp-hackers mailing list