Resumen del problema
Al editar manualmente la traducción de una categoría de producto desde ProductosCategorí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
Este problema está solucionado. Actualizar a la última versión lo soluciona en su sitio, por lo que solo necesita esta solución alternativa si aún no puede actualizar.
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 ''; }