WPML

問題の概要

Advanced Custom Fields: ExtendedおよびAdvanced Custom Fields Proプラグインも使用している場合、Advanced Custom Fields Multilingualプラグインをバージョン2.1.4.1にアップデートした後に致命的なエラーが発生する場合があります:

Fatal error: Uncaught InvalidArgumentException: item should be a Collection or an array or an object in .../wp-content/plugins/sitepress-multilingual-cms/vendor/wpml/fp/core/Obj.php:112

回避策

作業を進める前に、必ずサイトの完全なバックアップを取得してください。

  • …/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php ファイルを開きます。
  • 280行目を探します。
  • 次のコードを:
    private static function isValidOptionPagePostId( $postId ) {
    	return function_exists( 'acf_get_options_pages' )
    	       && wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    }
  • 以下に置き換えます:
    private static function isValidOptionPagePostId( $postId ) {
    	if ( function_exists( 'acf_get_options_pages' ) ) {
    		$optionPages = acf_get_options_pages();
    
    		if ( $optionPages ) {
    			return wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    		}		
    	}
    
    	return false;
    }

すべての既知の問題