Last active
November 11, 2020 17:39
-
-
Save djrmom/c77eeda0cc1d1e1477271b13bc435ad1 to your computer and use it in GitHub Desktop.
facetwp only facetwp=>true for main query
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 | |
/** only use queries with facetwp=>true in its args | |
** this can be used with facetwp templates by adding facetwp=>true | |
** in all your template queries | |
**/ | |
add_filter( 'facetwp_is_main_query', function( $is_main_query, $query ) { | |
if ( true !== $query->get( 'facetwp' ) ) { | |
$is_main_query = false; | |
} | |
return $is_main_query; | |
}, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment