Topic Resolution: Resolved
  • Open
  • Jim Blankenship
    December 13, 2023 at 10:38 pm #49207

    I am seeing this PHP Fatal error using Evolve Plus on WP 6.4.2:

    PHP Fatal error: Uncaught Error: Call to undefined function get_header() in /nas/content/live/blankenshipfin/wp-content/themes/evolve-plus/index.php:11\nStack trace:\n#0 {main}\n thrown in /nas/content/live/blankenshipfin/wp-content/themes/evolve-plus/index.php on line 11

    I’m not sure what action is causing this error but it seems to come up relatively often (multiple times daily).

    Any guidance is appreciated.

    Posts: 979
    December 14, 2023 at 8:10 pm #49208

    Hi. I’m sorry to hear that you experience this problem. Since this is a standard WordPress function, there can be a number of issues causing it:
    1. Try to re-install WordPress
    2. Try to re-install the theme
    3. Make sure that header.php is present in your installation
    4. It might be a plugin conflict – try deactivating them all to see if the problem persists.
    5. Make sure that all WordPress files have the recommended permissions (644 for files, 755 for folders)
    There could be other reasons, but these are the usual suspects.
    do let me know if it helped.

    Jim Blankenship
    Posts: 1
    December 15, 2023 at 3:48 pm #49210

    Thanks for the suggestions. I believe I have resolved this error in a different fashion.

    From my research on the error, I have learned that this repeated error is likely a bot attempting to connect to the theme index.php file directly, rather than via WP as is the common method.

    Addition of a checker in the php of the theme’s index.php file to determine if WP is loaded avoids this error. Since it is not desired (in my use) to connect directly to the theme’s index.php file (could also be 404.php, archive.php or possibly others), adding this line only subverts the bad actor.

    This is the “checker” line:
    if ( !defined( ‘ABSPATH’ ) ) exit; // don’t allow to call the file directly

    It is added after the initial <?php tag, and before any other code in the index.php file, or whatever .php file is being attacked.

    Posts: 979
    December 15, 2023 at 4:35 pm #49211

    Hi. Thanks for letting me know. I’m not sure how universal this solution is, but if it works for you and you remember adding it repeatedly after theme updates, great. Let me know if you need anything else.