Skip to content

Instantly share code, notes, and snippets.

@djrmom
Created March 25, 2019 21:37
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 djrmom/10518ebf01a0fabfcd9e0834caea7752 to your computer and use it in GitHub Desktop.
Save djrmom/10518ebf01a0fabfcd9e0834caea7752 to your computer and use it in GitHub Desktop.
facetwp is_home post type
<?php
/** makes sure the is_home query defaults to post rather than any post_type **/
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) {
if ( is_home() && $is_main_query && empty( $query->get('post_type') ) ) {
$query->set( 'post_type', 'post' );
}
return $is_main_query;
}, 10, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment