当我们从5.0.4升级到5.1.1时,站点停止加载。
错误消息为
Fatal error: Uncaught Error: Call to a member function images_path() on null
/wp-content/themes/mytheme/header.php on line 49
第49行是<?php $theme->images_path(); ?>
在同一文件中,它的上方是global $theme;
$主题在函数中创建。php作为自定义主题的实例。
class MyTheme {
private $theme_name = "MyTheme";
private $scripts_version = \'0.90\';
function __construct() {
add_action(\'init\', array($this, \'init_assets\'));
...several of these
...more methods
}
}
...other stuff
$theme = new MyTheme();
我不知道如何解决这个问题。在升级之前,一切都很好,没有对站点进行其他更改。感谢您的帮助。