WheatBeak February 2016

Mysterious "Call to undefined function get_header()" error logged in my theme directory, can't figure out why

It seems like every couple of days I'll ftp into this particular WordPress site and there will be a small error log in my theme directory, with the "Call to undefined function get_header()" error maybe 5 or 6 times on the theme index file.

I have navigated every single page of the site, every single post, every single attachment, every section in the admin back end, filled out every form, and no matter what I do I can't reproduce the error. However, after a couple of days I'll ftp in and see that it had happened a few more times.

This is no big deal as my site is 100% functional, and the size of the error log is insignificant, but I'm just going nuts trying to figure out why it's happening.

Has anyone else ever experienced this?

Answers


Vasim Vanzara February 2016

Generally this happens when someone has mistakenly put index.php from a theme in the WP install folder, where it overwrites the index.php that is the main WordPress file.

Download WordPress again, and take the one file, index.php from its root folder, replacing the file you now have as index.php

It sometimes means someone has loaded an entire theme into the root WP folder.

Update: I went to wp-config.php and change this:

<?php
/** Enable W3 Total Cache */
define('WP_CACHE', true); //Added by WP-Cache Manager

to this:

<?php
/** Enable W3 Total Cache */
define('WP_CACHE', false); //Added by WP-Cache Manager

I then followed the link above you supplied to the direct path and I still receive the same error? Am I doing this wrong?

I'm not even using the w3 total Cache plugin not sure why that's there?


markratledge February 2016

I've seen this on a number of sites and a number of different themes, and I think the errors are the results of bot traffic hitting theme files other than index.php I don't know for sure, but the errors are so hit and miss that I figure that's what is happening.

If your error log also logs the times of the errors, see if there are 404 errors (in your 404 log, or set one up) that correspond to the same times. Or try and match up IPs, if both error logs also record the IP. Either will give you more of an idea of what's happening.

Post Status

Asked in February 2016
Viewed 3,473 times
Voted 9
Answered 2 times

Search




Leave an answer