Skip to content

Instantly share code, notes, and snippets.

@geoffgraham
Forked from jazbek/gist:7442734
Last active October 29, 2015 19:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save geoffgraham/3f3e25f88856cb6c51cf to your computer and use it in GitHub Desktop.
Save geoffgraham/3f3e25f88856cb6c51cf to your computer and use it in GitHub Desktop.
Fix for broken tag archives
add_action( 'parse_query', 'tribe_fix_tag_query' );
function tribe_fix_tag_query( $query ) {
if ( $query->is_tag && (array) $query->get( 'post_type' ) != array( Tribe__Events::POSTTYPE ) ) {
if ( empty( $query->query_vars['post_type'] ) ) {
$query->query_vars['post_type'] = array( 'post' );
}
if ( ! ( $query->query_vars['post_type'] == array( 'post' ) || $query->query_vars == 'post' ) ) {
remove_action( 'parse_query', array( 'Tribe__Events__Query', 'parse_query' ), 50 );
remove_action( 'pre_get_posts', array( 'Tribe__Events__Query', 'pre_get_posts' ), 50 );
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment