Skip to content

Instantly share code, notes, and snippets.

Created February 16, 2016 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save anonymous/4ee9af8d8502871ec061 to your computer and use it in GitHub Desktop.
Save anonymous/4ee9af8d8502871ec061 to your computer and use it in GitHub Desktop.
add_action( 'pre_get_posts', 'test_per_dic' );
/**
* Exclude Category from Blog
*
* @author Bill Erickson
* @link http://www.billerickson.net/customize-the-wordpress-query/
* @param object $query data
*
*/
function test_per_dic( $query ) {
if( $query->is_main_query() && $query->is_archive()) {
$query->set( 'cat', '-64' );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment