
Jblogger
1
Épsilon
Redactor
Verificación en dos pasos activada
Suscripción a IA
Para evitar contenido duplicado en categorías o etiquetas cuando sólo hay un post en ellas, añadid el siguiente código en vuestro functions.php
Esta función redirige aquella tag o categoría donde sólo hay un artículo, a ese artículo en concreto.
Muy útil para Google Panda/Penguin
Espero que os sirva 🙂
Fuente: Wordpress Redirect to a single post if one post in category or tag - WordPress Snippets, Code, Hacks, 590+ for your theme, blog
function redirect_to_post(){
global $wp_query;
if( is_archive() && $wp_query->post_count == 1 ){
the_post();
$post_url = get_permalink();
wp_redirect( $post_url );
}
}
add_action('template_redirect', 'redirect_to_post');
Esta función redirige aquella tag o categoría donde sólo hay un artículo, a ese artículo en concreto.
Muy útil para Google Panda/Penguin
Espero que os sirva 🙂
Fuente: Wordpress Redirect to a single post if one post in category or tag - WordPress Snippets, Code, Hacks, 590+ for your theme, blog