Created
February 8, 2019 10:36
-
-
Save nickcernis/a8fd5f739169b5894ad285a6622500ea to your computer and use it in GitHub Desktop.
Exclude Genesis Portfolio taxonomies on the portfolio archive
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 // omit this line from functions.php | |
add_filter( 'pre_get_posts', 'custom_remove_portfolio_taxonomy' ); | |
function custom_remove_portfolio_taxonomy( $query ) { | |
if ( is_post_type_archive( 'portfolio' ) && $query->is_main_query() ) { | |
$tax_query = array( | |
array( | |
'taxonomy' => 'portfolio-type', | |
'field' => 'slug', | |
'terms' => array( 'type1', 'type2' ), // Change this to use the portfolio taxonomies you want to exclude. | |
'operator'=> 'NOT IN' | |
) | |
); | |
$query->set( 'tax_query', $tax_query ); | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment