How can you trigger a 404 when using custom query vars? I've got re-write rules written for a custom query var, but if you were to request a URL for the query var that should technically be a 404 it returns a normal WP page, but no content, because nothing technically exists for the URL.
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
There is a method specifically for this:
That should load the 404.php template in your theme, if you have it. Otherwise, it will fall back to index.php. This will also trigger a HTTP 404 status code. |
|||||
|
|
|
Add a 404.php to your theme and look if it is called. Sample 404.php
What is more important: the real HTTP headers, here the status code. You can see it with your browsers developer tools under network. Here is a screen shot for
If you still get a status code 200, look into the global variables |
|||
|
|
