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

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

自从我在 12 月转向多域托管以来,我的网站一直被错误所困扰。有太多的问题,我已经忘记了它们。每天我都会遇到一个我一无所知的令人震惊的新错误。

最近的一个无法访问我网站上的作者简介 - http://www.theunbiasedblog.com/author/nikhil

除以下内容外,网站的其余部分运行正常:

  1. 作者简介(上面提到)这个错误

    Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/author.php on line 11
    
  2. 站点上的标记链接 (http://www.theunbiasedblog.com/tag/windows) 出现此错误

    Fatal error: Call to undefined function get_header() in /home/theun3wr/public_html/tag.php on line 11
    
  3. 网站上的分类链接 (theunbiasedblogcom/category/tech)

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

我不知道如何处理所有这些非功能性链接的第 11 行的 get_header()。结果,我从 google.

收到了 30K 404 错误

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

我有这个-

 /**
 * 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');
 }

确保您在活动主题中定义了此功能

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');
}