Created
December 3, 2015 17:47
-
-
Save gecugamo/6516f416805499dde475 to your computer and use it in GitHub Desktop.
Pre Get Posts Filter
This file contains hidden or 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 | |
function pgp_filter( $query ) { | |
if ( $query->is_main_query() && !is_admin() ) { | |
$query->set( $key, $value ); | |
} | |
} | |
add_action( 'pre_get_posts', 'pgp_filter' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment