WPML

ภาพรวมของปัญหา

คุณอาจพบข้อผิดพลาดร้ายแรงหลังจากอัปเดตปลั๊กอิน Advanced Custom Fields Multilingual เป็นเวอร์ชัน 2.1.4.1 เมื่อใช้งานร่วมกับปลั๊กอิน Advanced Custom Fields: Extended และ Advanced Custom Fields Pro:

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;
    }

ปัญหาที่ทราบแล้วทั้งหมด