WPML

סקירת התקלה

בעת עריכה ידנית של תרגום קטגוריית מוצרים מתוך מוצריםקטגוריות, 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.
  • החלף את:
    PHP
    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 );
    }
  • ב:
    PHP
    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 '';
    }

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

עדיין נתקל בבעיה זו?

אם העדכון אינו פותר זאת, פתח פנייה לתמיכה ואנו נבדוק זאת יחד איתך.