I’m doing a WordPress plugin that handles all 404 page not found pages via another system.
I have a few problems now :
- To display the content of the other system inside WordPress, I’m using ”template_include” filter, which doesn’t seem wise.
- I can’t change status code of the page from 404 to 200, when the external system finds content for that request.
Any help would be highly appreciated, mostly on the part of changing status code output of WordPress.
That will help you change the HTTP status code of the page from 404 to 200:
And then you can display the content of the other system inside WordPress in 404.php template.
In addition to status code you might want to change page title. It will print “Page Not Found” even if you change status code. But a little simple filter can help you out: