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 '';
    }
            

כל התקלות הידועות →