WPML
ステータス
解決済み
報告対象
WPML Multilingual CMS 4.6.12
解決されたバージョン
WPML 4.7
関連するプラグイン/テーマ
Divi
トピックタグ
Compatibility

問題の概要

DiviテーマWPMLを使用して翻訳を100%完了しても、ページが翻訳済みとしてマークされない問題が発生する場合があります。また、以下のエラーがログに記録される場合があります。

PHP Fatal error:  Uncaught TypeError: htmlspecialchars_decode(): Argument #1 ($string) must be of type string, array given in .../wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.php:203

回避策

作業を進める前に、必ずサイトの完全なバックアップを取得してください。


  • …/wp-content/plugins/sitepress-multilingual-cms/addons/wpml-page-builders/classes/Shared/st/strategy/shortcode/class-wpml-pb-update-shortcodes-in-content.phpファイルを開きます。

  • 206行目を探します。

  • 以下のコードを:
    		if ( 'allow_html_tags' !== $encoding ) {
    			$translation = htmlspecialchars( htmlspecialchars_decode( $translation ) );
    		}


  • 次のように置き換えます:
    		// Ensure $translation is a string
    		if (is_array($translation)) {
    			// Handle array to string conversion as needed
    			$translation = implode('', $translation);
    		}
    
    		if ( 'allow_html_tags' !== $encoding ) {
    			$translation = htmlspecialchars( htmlspecialchars_decode( $translation ) );
    		}

すべての既知の問題 →