Is your WordPress theme not showing custom post on Author Archive page? Add the following code snippet to functions.php file. This WordPress hook will include custom post types in WordPress Author archive page.

//include snippet in author archive template
function custom_archive_query( $query ) {
	if ( is_author() && $query->is_main_query()) {
		$query->set( 'post_type', array( 'post', 'deals' , 'books' ) );
	}
	return $query;
}
add_filter( 'pre_get_posts', 'custom_archive_query' );
Tagged in : PHP WordPress

Nilanchala

A blogger, a bit of tech freak and a software developer. He is a thought leader in the fusion of design and mobile technologies. He is the author of Xamarin Mobile Application Development for Android Book (goo.gl/qUZ0XV3), DZone MVB and founder of stacktips.com.

Join The Discussion

Please note: We reserve the right to delete comments that contains snarky remarks, offensive or off-topic. To know more read our comments policy.