Theme’s 404.php is being loaded “behind the scenes”
-
So after a lot of debugging I’ve found this to be the situation.
My theme’s 404.php has an error_log print on it. I see it keeps being called every page load, sometimes numerous times. Even though the pages are loading fine.
I eventually found it to be because, in the HTML, there are broken images. (Test encironment, the images don’t exist on the server.)
For some reason, each time the page “encounters” one of these, the entire 404.php template – which means the theme’s header, sidebars, widgets, etc – are all processed and “rendered” – just not visually.
This has to do with .htaccess.
If I delete the standard .htaccess file, this does not occur. If I re-save permalinks to post-name, my pages work again but this 404 issue keeps happening.How to resolve this?
- The topic ‘Theme’s 404.php is being loaded “behind the scenes”’ is closed to new replies.