wordpressget-headers

Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/author.php on line 11


Since I shifted to multi-domain hosting in December, I'm plagued with errors on my website. There have been so many issues that I've lost track of them. And every day I end up with a shocking new error that I'm clueless about.

One of the most recent ones being not able to access author profile on my website - http://www.theunbiasedblog.com/author/nikhil

Rest of the website is working alright except these things:

  1. Author profiles (Mentioned Above) this error

    Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/author.php on line 11
    
  2. Tag links on the site (http://www.theunbiasedblog.com/tag/windows) give this error

    Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/tag.php on line 11
    
  3. Category links on the site (theunbiasedblogcom/category/tech)

    Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/category.php on line 11
    

I'm not able to figure out what to do with get_header() that is on line 11 of all these non functional links. As a result I've 30K 404 errors from google.

@prakashrao In wp-includes/general-template.php

I've this -

 /**
 * Load header template.
 *
 * Includes the header template for a theme or if a name is specified then a
 * specialised header will be included.
 *
 * For the parameter, if the file is called "header-special.php" then specify
 * "special".
 *
 * @since 1.5.0
 *
 * @param string $name The name of the specialised header.
 */
  function get_header( $name = null ) {
  /**
 * Fires before the header template file is loaded.
 *
 * The hook allows a specific header template file to be used in place of the
 * default header template file. If your file is called header-new.php,
 * you would specify the filename in the hook as get_header( 'new' ).
 *
 * @since 2.1.0
 * @since 2.8.0 $name parameter added.
 *
 * @param string $name Name of the specific header file to use.
 */
do_action( 'get_header', $name );

$templates = array();
$name = (string) $name;
if ( '' !== $name )
    $templates[] = "header-{$name}.php";

$templates[] = 'header.php';

// Backward compat code will be removed in a future release
if ('' == locate_template($templates, true))
    load_template( ABSPATH . WPINC . '/theme-compat/header.php');
 }

Solution

  • enter image description heremake sure you have this function defined in your active theme

    function get_header( $name = null ) {
        /**
         * Fires before the header template file is loaded.
         *
         * The hook allows a specific header template file to be used in place of the
         * default header template file. If your file is called header-new.php,
         * you would specify the filename in the hook as get_header( 'new' ).
         *
         * @since 2.1.0
         * @since 2.8.0 $name parameter added.
         *
         * @param string $name Name of the specific header file to use.
         */
        do_action( 'get_header', $name );
    
        $templates = array();
        $name = (string) $name;
        if ( '' !== $name )
            $templates[] = "header-{$name}.php";
    
        $templates[] = 'header.php';
    
        // Backward compat code will be removed in a future release
        if ('' == locate_template($templates, true))
            load_template( ABSPATH . WPINC . '/theme-compat/header.php');
    }