WPML
Stato
Risolto
Segnalato per
WPML Multilingual CMS 4.4.6
Risolto in
WPML 4.4.8

Panoramica del problema

Se vai alla pagina Personalizza o Widget nell’area di amministrazione del tuo sito, viene visualizzata una pagina bianca o un errore fatale:

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

Soluzione alternativa


  • Esegui un backup completo del tuo sito prima di procedere.

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

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


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


  • Modifica le tue opzioni di Personalizza e/o i widget.

  • Al termine delle modifiche, rimuovi il codice aggiunto nel passaggio 2.
  • Apri il file: wp-content/plugins/sitepress-multilingual-cms/sitepress.class.php
  • Cambia:
    		$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;
    			}
    		}
  • In:
    		$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;
    			}
    		}

Tutti i problemi noti →