Created
December 25, 2011 19:45
-
-
Save anonymous/1519659 to your computer and use it in GitHub Desktop.
Excluded featured from main category 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 | |
function be_exclude_category_featured( $query ) { | |
if( $query->is_main_query() && $query->is_category() ) { | |
$meta_query = array( | |
array( | |
'key' => 'be_category_featured', | |
'value' => 'on', | |
'compare' => '!=' | |
); | |
$query->set( 'meta_query', $meta_query ); | |
} | |
} | |
add_action( 'pre_get_posts', 'be_exclude_category_featured' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment