- 状态
- 已解决
- 报告针对
- Advanced Custom Fields Multilingual 1.10.4
- 解决于
- 2.0.0
- 相关插件/主题
- Advanced Custom Fields (ACF)
- 主题标签
- Compatibility
问题概述
在使用 PHP 8.0 的服务器上使用 ACF 和 WPML 时,如果将字段组设置为在选项页面上显示,会出现以下错误:
Warning: Trying to access array offset on value of type null in /wp-content/plugins/acfml/classes/strategy/repeater-shuffle/OptionsPage.php on line 184
Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /wp-content/plugins/acfml/classes/strategy/repeater-shuffle/strategy.php on line 126
请注意,不建议在只有一种活动语言的情况下安装 WPML。
临时解决方法
在继续操作之前,请确保您已对站点进行了完整备份。
- 编辑文件 /wp-content/plugins/acfml/classes/strategy/repeater-shuffle/OptionsPage.php。
- 转到第 184 行。
- 将:
return $this->element_translations[ $id ];
替换为:
return $this->element_translations[ $id ] ?? [];