Force category-slug.php to show page, even if it doesn’t exist

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.

Read More

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?

Related posts

Leave a Reply

1 comment

  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.