wordpress - 我收到错误:解析错误:语法错误,意外的“if”(T_IF),期待函数(T_FUNCTION)
问题描述
我的网站显示 Parse 错误,当我尝试禁用特定插件时,情况变得更糟并开始在另一个 jetpack 插件中显示错误,如果我禁用所有插件,错误会显示在其他文件中。请帮忙,我的网站已经关闭了两天。
尝试禁用插件,重新安装插件,删除错误代码行
/**
* Define Mega Menu constants
*
* @since 1.0
*/
private function define_constants() {
define( 'MEGAMENU_VERSION', $this->version );
define( 'MEGAMENU_BASE_URL', trailingslashit( plugins_url( 'megamenu' ) ) );
define( 'MEGAMENU_PATH', plugin_dir_path( __FILE__ ) );
}
// populate grid sub menus
if ( $item->depth === 0 && $item->megamenu_settings['type'] == 'grid' || ( $item->depth === 1 && $item->parent_submenu_type == 'tabbed' && $item->megamenu_settings['type'] == 'grid') ) {
$saved_grid = $widget_manager->get_grid_widgets_and_menu_items_for_menu_id( $item->ID, $args->menu->term_id, $items );
$next_order = $this->menu_order_of_next_sibling( $item->ID, $item->menu_item_parent, $items) - 999;
foreach ( $saved_grid as $row => $row_data ) {
$rolling_dummy_id++;
$next_order++;
错误信息:
Parse error: syntax error, unexpected 'if' (T_IF), expecting function (T_FUNCTION) in /home/u912283588/domains/meersgavhb.com/public_html/wp-content/plugins/megamenu/megamenu.php on line 309
The site is experiencing technical difficulties.
解决方案
推荐阅读
- arrays - 如何将稀疏 numpy 数组转换为 Dataframe?
- java - Selenium 不会重新调整在 devtools 上显示的 XPath
- python - 无法将情节图例定位在情节边界之外
- vue.js - 如何在 vuejs3 应用程序的设置中调用方法?
- python - 循环如何在基本计算机级别上工作?
- android - 仅在 Xamarin Android 中长按项目时显示工具栏图标
- amazon-web-services - AWS Fargate 任务抛出 Asm 获取用户名:AuthorizationData 格式错误,为空字段
- ios - SwiftUI | 在模拟器上找到文件但在 iOS 设备上找不到
- opengl - 如何使用曲面细分应用置换贴图?
- gitlab - Gitlab CI SAST 在下一阶段使用 gl-sast-report.json 报告的工件,使用了 2 种不同的扫描仪