I’ve created a template redirect for a given url, ex.: test.com/test
Test is page is not exists, i’m just checking the url from query_vars, if its match, i load the template with
include(file.php);
exit;
The page loads and show what i expect, but the title is Page not found. I solve this with a filter, but i saw that the whole page comes with a 404 status. Btw i saw that the builtin multisite activation message also has a 404 header. (I’m working on localhost.)
How can i solve this without creating the page itself in wp?
You are essentially trying to create a “fake” page without having to create a physical page in the WordPress database and for that, you will need custom re-write rules.
For more details see my answer here: Setting a custom sub-path for blog without using pages?
Quick overview:
step 1: setup your custom rewrite rules
Step 2: properly include a template file on matching your query variable,