Hi,
Is there a plugin (or hack) 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.
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');
Works fine on one of my blog. But on my other blog writes “Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.” What’s the problem?