WPML
状态
已解决
报告针对
Advanced Custom Fields Multilingual 2.1.4
解决于
Advanced Custom Fields Multilingual 2.1.4.1
相关插件/主题
Advanced Custom Fields (ACF)
主题标签
Bug

问题概述

如果您在使用Advanced Custom Fields免费版时更新到了Advanced Custom Fields Multilingual 2.1.4 版,您可能会由于未定义的函数acf_get_options_pages()而遇到致命错误:

PHP Fatal error:  Uncaught SymfonyComponentDebugExceptionFatalThrowableError: Call to undefined function acf_get_options_pages() in .../wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php:281

临时解决方法

在继续操作之前,请确保对站点进行完整备份


  • 打开 …/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php 文件。

  • 找到第 280 行。

  • 替换:
    	private static function isValidOptionPagePostId( $postId ) {
    		return (bool) wpml_collect( acf_get_options_pages() )
    			->first( Relation::propEq( 'post_id', $postId ) );
    	}


  • 替换为:
    	private static function isValidOptionPagePostId( $postId ) {
    		return function_exists( 'acf_get_options_pages' )
    			&& wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    	}

所有已知问题 →