WPML
Status
Resolved
Reported for
WPML Multilingual CMS 4.4.6
Resolved in
WPML 4.4.8

Overview of the issue

If you go to the Customizer or Widgets page in your site’s admin, a blank page or fatal error is shown:

PHP 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:97

Workaround


  • Make a full backup of your site before proceeding.

  • Open the file /wp-content/plugins/sitepress-multilingual-cms/classes/widgets/class-wpml-widgets-support-backend.php.

  • Change:
    			'selected_language' => Obj::propOr( 'all', 'wpml_language', $instance ),


  • To:
    			'selected_language' => Obj::propOr( 'all', 'wpml_language', is_array( $instance ) ? $instance : [] ),


  • Edit your Customizer options and/or widgets.

  • When done editing, remove the code added in step 2.
  • Open the file: wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php
  • Change:
    		$post_types = get_post_types( $args, 'objects' );
    
    		foreach ( $post_types as $name => $attrs ) {
    			$slug = trim( Obj::pathOr( '', [ 'rewrite', 'slug' ], $attrs ), '/' );
    			if ( $slug && isset( $vars[ $slug ] ) ) {
    				$post_type = $name;
    				$post_slug = $vars[ $slug ];
    				break;
    			}
    		}
  • To:
    		$post_types = get_post_types( $args, 'objects' );
    
    		foreach ( $post_types as $name => $attrs ) {
    		    if ( $attrs->rewrite == false ) {
    		        break;
    		    }
    			$slug = trim( Obj::pathOr( '', [ 'rewrite', 'slug' ], $attrs ), '/' );
    			if ( $slug && isset( $vars[ $slug ] ) ) {
    				$post_type = $name;
    				$post_slug = $vars[ $slug ];
    				break;
    			}
    		}

All known issues →