WPML
الحالة
في انتظار المطور
الإضافة/القالب ذو الصلة
Yoast SEO
وسوم الموضوع
Compatibility

نظرة عامة على المشكلة

عند تعديل ترجمة تصنيف المنتج يدوياً من المنتجات > التصنيفات، أنشأت Yoast SEO Premium عمليات إعادة توجيه 301 بشكل غير صحيح حتى عند تغيير وصف/نص التصنيف فقط (وليس المعرّف النصي للرابط).

تحتوي عمليات إعادة التوجيه المُنشأة على عناوين URL ذات بنية خاطئة:

عنوان URL القديم: http://site.com/product-category/test-es-wpml

عنوان URL الجديد: http://site.com/http://es.site.com/product-category/test-es-wpml/ (عنوان URL مزدوج!)

ملاحظة: هذا خطأ مرئي، ولا تتسبب عمليات إعادة التوجيه هذه في مشاكل في التصفح

حل بديل مؤقت

تأكد من أخذ نسخة احتياطية كاملة لموقعك قبل المتابعة.


  • افتح الملف …/wp-content/plugins/wordpress-seo-premium/classes/term-watcher.php.

  • ابحث عن الدالة «protected function get_target_url(»، وستجدها بالقرب من السطر 241.

  • استبدل:
    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 );
    }
            


  • بـ:
    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 '';
    }
            

جميع المشاكل المعروفة →