add_action( 'pre_get_posts', 'post_types_author_archives' );
/**
* Adds `wiki` Custom Post Type to Author Archives.
*/
function post_types_author_archives( $query ) {
// Adds 'wiki' post type to author archives.
if ( $query->is_author ) {
$query->set( 'post_type', array( 'post', 'wiki' ) );
}
// Remove the action after it's run.
remove_action( 'pre_get_posts', 'post_types_author_archives' );
}