Created
October 1, 2012 14:32
-
-
Save jartes/3812138 to your computer and use it in GitHub Desktop.
Hide category from the Home 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
// More info: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts | |
function hide_cat_home_query ( $query ) { | |
if ( $query->is_home() && $query->is_main_query() ) { | |
$the_cat_id = get_cat_ID('cat_name'); | |
$query->set('cat', '-'.$the_cat_id); | |
} | |
} | |
add_action('pre_get_posts', 'hide_cat_home_query'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment