is there a quick way to hide category from everywhere?

pre_get_posts is the right hook for this

since i just did category exclusion in another answer i will post it here too.
Exclude the category from the WordPress loop

based on the codex sample:

http://codex.wordpress.org/Custom_Queries#Category_Exclusion

add_action('pre_get_posts', 'wpa_31553' );

function wpa_31553( $wp_query ) {

    //$wp_query is passed by reference.  we don't need to return anything. whatever changes made inside this function will automatically effect the global variable

    $excluded = array(272);  //made it an array in case you need to exclude more than one

    // only exclude on the front end
    if( !is_admin() ) {
        $wp_query->set('category__not_in', $excluded);
    }
}

Leave a Comment