Uncaught Error: Call to undefined function get_header()
-
Hi, once in a while my site generates PHP errors like this:
Fatal error: Uncaught Error: Call to undefined function get_header() in /home/c501c527/public_html/joewestcott/wp-content/themes/twentynineteen/index.php:17 Stack trace: #0 {main} thrown in /home/c501c527/public_html/joewestcott/wp-content/themes/twentynineteen/index.php on line 17
I searched online to understand why this is happening, and it seems that it might be a flaw in the Twenty Nineteen index.php file, where it starts with code like this:
<?php get_header(); ?>
This code generates a PHP error when anyone (and/or a bot) visits the /twentynineteen/ folder.
One possible fix I found online is to change the theme code to something like this:
<?php if (!defined('ABSPATH')) exit; get_header(); ?>
… but we shouldn’t edit stock WordPress theme code.
Is there another recommended solution?
Or is this a known bug that the Twenty Nineteen theme developers are working on?
Thank you,
JoeThe page I need help with: [log in to see the link]
- The topic ‘Uncaught Error: Call to undefined function get_header()’ is closed to new replies.