WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a custom query in category-slug.php, which works fine unless the category doesn't have that number of pages itself.

If the category only has 5 pages of posts, but the query I put in has 7, it'll show 404 for pages 6 and 7.

Pretty sure the reason for this is that category-slug.php checks to see if there is a page for that category before it gets to the query I have in the file.

Is there a way for me to force it to run the page instead of showing a 404?

share|improve this question
up vote 2 down vote accepted

I've not tested this, but adding an action after parse_query or wp which checks if the current request is_category(), and then setting the is_404 property of the global $wp_query to false might set you off in the right direction.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.