- 状态
- 未解决
- 相关插件/主题
- Bricks
- 主题标签
- Compatibility
问题概述
当在 Bricks 模板中使用 WPML 的复制功能,且激活了 WPML Media Translation 插件时,您会发现默认语言的更改未反映到其他语言中。
临时解决方法
请在继续操作前,确保对您的站点进行完整的站点备份。
第一部分
- 打开 …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-custom-field-images-translation.php 文件。
- 找到第 56 行。
- 紧接在以下代码之后:
$setting = $settings_factory->post_meta_setting( $meta_key );
- 添加:
// Workaround part 1 $bricks_meta_keys = array( '_bricks_template_type', '_bricks_page_content_2', '_bricks_editor_mode', '_bricks_template_settings', ); if ( strpos( $meta_key, 'bricks' ) !== false ) { return; }
第二部分
- 打开 …/wp-content/plugins/wpml-media-translation/classes/media-translation/class-wpml-media-set-posts-media-flag.php 文件。
- 找到第 128 行。
- 紧接在以下代码之后:
$post_with_media_files = $this->post_with_media_files_factory->create( $post_id );
- 注释掉以下部分:
// Workaround part 2 /*if ( $post_with_media_files->get_media_ids() ) { // it seems that this line is causing this issue update_post_meta( $post_id, self::HAS_MEDIA_POST_FLAG, 1 ); } else { delete_post_meta( $post_id, self::HAS_MEDIA_POST_FLAG ); }*/