Created
March 25, 2019 21:37
-
-
Save djrmom/10518ebf01a0fabfcd9e0834caea7752 to your computer and use it in GitHub Desktop.
facetwp is_home post type
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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