- Trạng thái
- Đã được giải quyết bởi nhà phát triển
- Được báo cáo cho
- WPML SEO 2.1.0
- Đã giải quyết trong
- SEOPress 8.4
- Plugin/giao diện liên quan
- SEOPress
- Thẻ chủ đề
- Compatibility
Tổng quan về lỗi
Khi sử dụng plugin SEOPress với WPML, các slug lưu trữ sản phẩm không được dịch chính xác trong sitemap XML do SEOPress tạo ra.
Giải pháp tạm thời
Vui lòng đảm bảo bạn có bản sao lưu toàn bộ trang web của mình trước khi tiếp tục.
- Mở tệp …/wp-content/plugins/wp-seopress/templates/sitemap/single.php.
- Tìm dòng 41.
- Thay thế:
// WPML Workaround if (class_exists('SitePress')) { if ( 2 != apply_filters( 'wpml_setting', false, 'language_negotiation_type' ) ) { $original_language = apply_filters( 'wpml_current_language', NULL ); $language_list = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' ); if (!empty($language_list)) { foreach ($language_list as $key => $language_infos ) { if ($original_language != $language_infos['language_code']) { // Switch Language do_action( 'wpml_switch_language', $language_infos['language_code']); $archive_links[] = htmlspecialchars(urldecode(user_trailingslashit(get_post_type_archive_link($path)))); // Restore language to the original do_action( 'wpml_switch_language', $original_language); } } } } - Bằng:
// WPML Workaround for compsupp-7538 and compsupp-6419 if ( class_exists('SitePress' )) { if ( 2 != apply_filters( 'wpml_setting', false, 'language_negotiation_type' ) ) { $original_language = apply_filters( 'wpml_current_language', NULL ); $language_list = apply_filters( 'wpml_active_languages', NULL, 'orderby=id&order=desc' ); if (!empty($language_list)) { foreach ($language_list as $key => $language_infos ) { if ($original_language != $language_infos['language_code']) { // Switch Language do_action( 'wpml_switch_language', $language_infos['language_code']); if ( $path == 'product' && function_exists('wc_get_page_id') ) { $shop_page_id = wc_get_page_id('shop'); $archive_links[] = htmlspecialchars(urldecode(user_trailingslashit(get_permalink($shop_page_id)))); } else { $archive_links[] = htmlspecialchars(urldecode(user_trailingslashit(get_post_type_archive_link($path)))); } // Restore language to the original do_action( 'wpml_switch_language', $original_language); } } } } }