If one tries to load a theme template file directly, the following error message is displayed:
Fatal error: Call to undefined function get_header() in ...
and it goes on to list the full directory path to the wordpress install. This seems undesirable. How can I prevent it? Upon googling I found a suggestion to insert the following into wp-config.php:
error_reporting(0);
@ini_set(âdisplay_errorsâ, 0);
Oddly, it did not work when I tested it.
Thank you!
I define some variables used in my theme at the top of functions.php….one of them being
Then at the top of my template files I use
Which then gives the error message I define there when being accessed directly, nothing more.
(Thanks @t31os )