Skip to content

Instantly share code, notes, and snippets.

@jwebcat
Created January 24, 2014 08:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jwebcat/8593828 to your computer and use it in GitHub Desktop.
Save jwebcat/8593828 to your computer and use it in GitHub Desktop.
Add custom post types to pre_get_posts for main loop WP
add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) {
if ( is_category() && $query->is_main_query() )
$query->set( 'post_type', array( 'post', 'page', 'fonts' ) );
return $query;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment