WPML
ステータス
解決済み
報告対象
Advanced Custom Fields Multilingual 2.0.5
解決されたバージョン
Advanced Custom Fields Multilingual 2.1.0
関連するプラグイン/テーマ
Advanced Custom Fields (ACF)
トピックタグ
Compatibility

問題の概要

Advanced Custom Fieldsプラグインを使用している場合、以下の致命的なエラーが発生することがあります。このエラーは特にPHP 8以降で確認されています:


Fatal error: Uncaught TypeError: Illegal offset type in isset or empty in .../wp-content/plugins/sitepress-multilingual-cms/classes/core-abstract-classes/class-wpml-element-translation.php:259

回避策

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


  • …/wp-content/plugins/acfml/classes/class-wpml-acf-attachments.php ファイルを開きます。

  • 28行目を探します。

  • 以下のコードを:
    			foreach ( $attachments as $key => $attachment_id ) {
    					$translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true );

  • 次のように置き換えます:
    			foreach ( $attachments as $key => $attachment_id ) {
    				if (is_int($attachment_id)) {
    					$translated_attachments[ $key ] = apply_filters( 'wpml_object_id', $attachment_id, 'attachment', true );
    				}

すべての既知の問題 →