调用未定义函数create_function

Rex*_*Rex 18 wordpress plugins localhost elementor

我尝试激活已安装的插件,但收到此错误。我无法再次打开该网站。我重新启动计算机并加载本地主机 URL,得到以下相同的错误:

致命错误:未捕获错误:调用 C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\extensions\google-maps\google-maps.php 中未定义的函数 create_function() :136 堆栈跟踪: #0 C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\extensions\google-maps\google-maps.php(441): stylepress_dtbaker_Shortcode_Google_Map-> init() #1 C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\inc\class.plugin.php(184): require_once('C:\xampp\htdocs ...') #2 C:\xampp\htdocs\university\wp-includes\class-wp-hook.php(307): DtbakerElementorManager->load_extensions('') #3 C:\xampp\htdocs\university\ wp-includes\class-wp-hook.php(331): WP_Hook->apply_filters(NULL, Array) #4 C:\xampp\htdocs\university\wp-includes\plugin.php(476): WP_Hook->do_action (数组) #5 C:\xampp\htdocs\university\wp-settings.php(598): do_action('init') #6 C:\xampp\htdocs\university\wp-config.php(96): require_once ('C:\xampp\htdocs...') #7 C:\xampp\htdocs\university\wp-load.php(50): require_once('C:\xampp\htdocs...') #8 C :\xampp\htdocs\university\wp-blog-header.php(13): require_once('C:\xampp\htdocs...') #9 C:\xampp\htdocs\university\index.php(17) : require('C:\xampp\htdocs...') #10 {main} 抛出在 C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\extensions\google 中-maps\google-maps.php 第 136 行

n8t*_*ael 9

我很难针对您的特定用例进行故障排除 - 但这里有一些注释和工具可以帮助您破译和解决这个问题。该错误是因为您在 PHP8 上运行,但您的代码与 PHP7 不兼容。

  1. 要么将服务器降级到 PHP7
  2. 或者更新扩展以兼容 PHP8
  3. 或者自己手动更新扩展。

PHP7 中已弃用的 create_function() 需要替换为匿名 PHP8 函数调用。

有关详细信息:请参阅:PHP 7.2 函数 create_function() 已弃用 以及: https: //www.php.net/manual/en/function.create-function.php

如果您想深入研究代码本身来解决此问题:

  1. 下载Notepad++ https://notepad-plus-plus.org/
  2. 在代码编辑器中打开此文档:C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\extensions\google-maps\google-maps.php
  3. 到达:136路
  4. 使用上面的注释并尝试使用上面的注释重写该函数。

您可能会在代码中使用其他已弃用的函数:

  1. 转到搜索 -> 在文件中查找 (Ctrl+Shift+F) 在 C:\xampp\htdocs\university\wp-content\plugins\full-site-builder-for-elementor\extensions\ 的文档库中搜索“create_function” (“
  2. 需要更新这些已折旧函数的实例才能消除错误。
  3. 请注意:此扩展中可能会出现其他类型的折旧代码错误。最好不要尝试单独修复这些问题,除非您没有其他选择,例如更新或降级 PHP 版本。


小智 4

某些插件或活动主题中的某些代码似乎与 PHP8 不兼容,这就是它抛出致命错误的原因。

请按照文章https://eikioya.com/fix-for-function-create_function-is-deprecated-in-php-7-2/解决此问题。