tag.php not including tags from custom post types

Ran into a very funny problem when creating a template, basically, when a tag was clicked and the template sourced the tag.php page it was not quering any posts in any of the custom post types on the website.

By adding the following code it fixed the issue:

function wpse28145_add_custom_types( $query ) {
if( is_tag() && $query->is_main_query() ) {

// this gets all post types:
$post_types = get_post_types();

// alternately, you can add just specific post types using this line instead of the above:
// $post_types = array( 'post', 'your_custom_type' );

$query->set( 'post_type', $post_types );
add_filter( 'pre_get_posts', 'wpse28145_add_custom_types' );