Обзор проблемы
Catchable fatal error: Object of class stdClass could not be converted to string in /home/lahjatup/public_html/markkinointiopisto.fi/wp-content/plugins/sitepress-multilingual-cms/inc/wpml-config/wpml-config.class.php on line 252
Или
Warning: dirname() expects parameter 1 to be string, object given in /home1/treasure/public_html/dev/wp-content/plugins/sitepress-multilingual-cms/inc/wpml-config/wpml-config.class.php on line 252
Вышеуказанные ошибки PHP появятся на страницах Вашей админ-панели, таких как страницы плагинов, тем оформления или Управление переводамиНастройка многоязычного контента.
Обходное решение
Эта проблема решена. Обновление до последней версии решает эту проблему на Вашем сайте, поэтому это обходное решение потребуется Вам только в том случае, если Вы пока не можете выполнить обновление.
- Подключитесь по FTP
- Найдите файл sitepress-multilingual-cms/
inc/wpml-config/wpml-config. class.php - Найдите строку, указанную в появившейся ошибке PHP (252). Например:
$type = ( dirname( $file ) == get_template_directory() || dirname( $file ) == get_stylesheet_directory() ) ? 'theme' : 'plugin'; $admin_text_context = basename( dirname( $file ) );
- Удалите обе строки кода
- В том же файле найдите следующий код (примерно на строке 210):
}else{ $config = icl_xml2array( file_get_contents( $file ) ); } - Измените этот блок кода следующим образом:
}else{ $config = icl_xml2array( file_get_contents( $file ) ); $type = ( dirname( $file ) == get_template_directory() || dirname( $file ) == get_stylesheet_directory() ) ? 'theme' : 'plugin'; $admin_text_context = basename( dirname( $file ) ); } - Сохраните файл и загрузите на Ваш сервер