WPML
Trạng thái
Đang chờ nhà phát triển
Plugin/giao diện liên quan
Yoast SEO
Thẻ chủ đề
Compatibility

Tổng quan về lỗi

Khi chỉnh sửa thủ công bản dịch danh mục sản phẩm từ Sản phẩm > Danh mục, Yoast SEO Premium đã tạo sai các chuyển hướng 301 ngay cả khi chỉ có miêu tả/văn bản của danh mục được thay đổi (không phải slug).

Các chuyển hướng được tạo có URL bị lỗi định dạng:

URL cũ: http://site.com/product-category/test-es-wpml

URL mới: http://site.com/http://es.site.com/product-category/test-es-wpml/ (URL kép!)

Lưu ý: Đây là lỗi hiển thị, các chuyển hướng này không gây ra sự cố điều hướng

Giải pháp tạm thời

Vui lòng đảm bảo 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/wordpress-seo-premium/classes/term-watcher.php.

  • Tìm hàm “protected function get_target_url(”, bạn sẽ thấy nó ở khoảng dòng 241.

  • Thay thế:
    protected function get_target_url( $tag, $taxonomy ) {
        // Get the term link.
        $term_link = get_term_link( $tag, $taxonomy );
    
        // Return early if the term link is not a string, i.e. a WP_Error Object.
        if ( ! is_string( $term_link ) ) {
            return '';
        }
    
        return str_replace( home_url(), '', $term_link );
    }
            


  • Bằng:
    protected function get_target_url( $tag, $taxonomy ) {
        // Get the term link.
        $term_link = get_term_link( $tag, $taxonomy );
    
        // Return early if the term link is not a string, i.e. a WP_Error Object.
        if ( ! is_string( $term_link ) ) {
            return '';
        }
    
        // Extract the path to handle WPML subdomain URLs (matches post-watcher behavior).
        $url = wp_parse_url( $term_link );
        if ( is_array( $url ) && isset( $url['path'] ) ) {
            return $url['path'];
        }
    
        return '';
    }
            

Tất cả các lỗi đã ghi nhận →