-
-
Save dancameron/2148602 to your computer and use it in GitHub Desktop.
WP: Action: Filter TAX Archive
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 filter_term_archive( $query ) { | |
if ( $query->is_tax('your_taxonomy') ) { | |
$query->set( 'tax_query', array( | |
'relation' => 'AND', // Change to OR if we only want to filter one type. | |
array( | |
'taxonomy' => some_custom_tax_slug(), | |
'field' => 'slug', | |
'terms' => $array_of_terms | |
), | |
array( | |
'taxonomy' => some_custom_post_type_tax_slug(), | |
'field' => 'slug', | |
'terms' => $current_archive_term | |
) | |
)); | |
} | |
} | |
add_filter( 'pre_get_posts', 'my_get_posts' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment