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?

1 Answer 1


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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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