I have created custom rewrite rules. These rules now go to 404 page as expected. I can use action hook
template_redirect to change the template matching
But I don't want to create separate template files as the page structure depend on the current theme in use. Rather I just want to change the content and title. I have tried change the content using
the_content filter, but it seems the filter doesn't even get called for 404 page.
I also tried loading
index.php template and then using
the_content filter, but it also doesn't work.
Is there any way to achieve this?