致命错误:在第11行的/home/theun3wr/public_html/author.php中调用未定义的函数get_header()

时间:2016-03-03 19:58:35

标签: wordpress get-headers

自从我在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
    
  4. 我无法弄清楚如何处理所有这些非功能性链接第11行的get_header()。因此,我发现谷歌有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');
     }
    

1 个答案:

答案 0 :(得分:0)

enter image description here确保您在活动主题中定义了此功能

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