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

כל התקלות הידועות