I have a website where I let people subscribe. I would like to only show the author page for actual authors who have written a post. I wrote this code that checks for post the problem is I can't use a wp_redirect
or include a template that uses it because then I get everyones favorite "cannot redifine headers header" message. I could display a "User has no post message but I think redirecting them to the main author page is a better option.
if ( is_author() ) : ?>
<?php $id = get_query_var( 'author' );
$post_count = get_usernumposts($id);
if($post_count <= 0){
//This line could also be wp_redirect
include( STYLESHEETPATH .'/author-redirect.php');
exit;
}
endif;?>
Thanks