WPML
Статус
Решено
Заявлено для
Advanced Custom Fields Multilingual 2.1.4.1
Решено в
Advanced Custom Fields Multilingual 2.1.4.2
Связанный плагин/тема
Advanced Custom Fields: Extended
Теги темы
Compatibility

Обзор проблемы

Вы можете столкнуться с фатальной ошибкой после обновления плагина 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;
    	}

Все известные проблемы →