Skip Navigation

Resolved

Reported for: Advanced Custom Fields Multilingual 2.1.4.1

Resolved in: Advanced Custom Fields Multilingual 2.1.4.2

Topic Tags: Compatibility

Overview of the issue

You may experience a fatal error after updating the Advanced Custom Fields Multilingual plugin to version 2.1.4.1 when also using the Advanced Custom Fields: Extended and Advanced Custom Fields Pro plugins:

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

Workaround

Please, make sure of having a full site backup of your site before proceeding.

  • Open …/wp-content/plugins/acfml/classes/class-wpml-acf-options-page.php file.
  • Look for line 280.
  • Replace:
    1
    2
    3
    4
    private static function isValidOptionPagePostId( $postId ) {
        return function_exists( 'acf_get_options_pages' )
               && wpml_collect( acf_get_options_pages() )->first( Relation::propEq( 'post_id', $postId ) );
    }
  • With:
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    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;
    }