Hi,
Is there a plugin that allows me to redirect users if there's only 1 post in category/tag page ? I mean redirect them directly to this single post.
Hi,
Is there a plugin that allows me to redirect users if there's only 1 post in category/tag page ? I mean redirect them directly to this single post.
Sure, but there is a better way to do that !
Simply paste this into your functions.php file (located in your theme folder)
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');
Then all the users will be redirected to the single post found in any category/tag page ;)
Cheers
You must log in to post.