Follow @BPSPro

Hide Fatal error: Call to undefined function get_header() Error Message

Comments Off RSS Site Feed Author: AITpro Admin
Published: September 30, 2010
Updated: February 26, 2011

The original question was regarding hiding the Fatal error: Call to undefined function get_header() Error Message that diplays your website Document Root Path when someone enters the path to your WordPress Theme index.php file.  The solution to hiding this error that displays your website Document Root Path means that you will be turning off error reporting for your WordPress Theme index.php file.

CAUTION!  This is not a solution to fix actual problems with your WordPress website or fix problems with your WordPress Theme.  This is strictly for hiding the Fatal error: Call to undefined function get_header() Error Message so that your WordPress website Document Root path is not displayed or exposed to the World.

Example of the error message:

Fatal error: Call to undefined function get_header() in /home4/xxxxxxxx/public_html/xxxxxxxxx/wp-content/themes/xxxxxxxx/index.php on line 1

Solution:  Add this line of code first at the very top of your WordPress Theme index.php file before any other code.

<?php ini_set('display_errors', 0); ?> 

Example result is a blank page without displaying your WordPress website Document Root Path:  http://www.ait-pro.com/aitpro-blog/wp-content/themes/AITpro/index.php

If you run into problems with your WordPress theme in the future and need to view error reporting for your WordPress Theme index.php file then you will have to comment out this line of code as shown below to troubleshoot the problem or code error.

<!-- <?php ini_set('display_errors', 0); ?> -->
Skip to toolbar