WPML
Estado
Esperando al autor
Plugin/tema relacionado
Yoast SEO
Etiquetas de temática
Compatibility

Resumen del problema

Al editar manualmente la traducción de una categoría de producto desde Productos > Categorías, Yoast SEO Premium creó incorrectamente redirecciones 301 incluso cuando solo se cambió la descripción/texto de la categoría (no el slug).

Las redirecciones creadas tienen URL mal formadas:

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

Nueva URL: http://site.com/http://es.site.com/product-category/test-es-wpml/ (¡URL doble!)

Nota: Este es un error visual, estas redirecciones no causan problemas de navegación

Solución alternativa

Por favor, asegúrese de tener una copia de seguridad completa de su sitio antes de continuar.


  • Abra el archivo …/wp-content/plugins/wordpress-seo-premium/classes/term-watcher.php.

  • Busque la función «protected function get_target_url(»; la encontrará alrededor de la línea 241.

  • Reemplace:
    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 );
    }
            


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

Todos los problemas conocidos →