Why do I see “Call to undefined function get_header()” errors logged in my theme directory?

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.

Read More

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?

Related posts

2 comments

  1. 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.

  2. 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?

Comments are closed.