我的函数中有以下代码。php:
require_once(\'widgets.php\');
function Menu_Widget() {
register_widget( \'Menu_Widget\' );
}
add_action( \'widgets_init\', \'Menu_Widget\' );
小部件的内容。php其实并不重要,因为即使是小部件也会出现错误。php为空。
通过这些行,转到wp admin页面会出现以下错误:
/var/www/html/page-name/wp-includes/functions.php on line 4139
Fatal error: Uncaught Error: Call to undefined function get_current_screen() in /var/www/html/page-name/wp-admin/widgets.php:51 Stack trace: #0 /var/www/html/page-name/wp-content/themes/dpsglohmar2017/functions.php(105): require_once() #1 /var/www/html/page-name/wp-settings.php(424): include(\'/var/www/html/d...\') #2 /var/www/html/page-name/wp-config.php(88): require_once(\'/var/www/html/d...\') #3 /var/www/html/page-name/wp-load.php(37): require_once(\'/var/www/html/d...\') #4 /var/www/html/page-name/wp-admin/admin.php(31): require_once(\'/var/www/html/d...\') #5 /var/www/html/page-name/wp-admin/about.php(10): require_once(\'/var/www/html/d...\') #6 {main} thrown in /var/www/html/page-name/wp-admin/widgets.php on line 51
当上述行是函数中唯一的行时,这两个错误都会出现。php。只有在服务器上执行时,错误才会出现在我的本地计算机上。删除所有插件时也会出现这些错误。