Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'pre_get_posts', array( $this,'function_pre_get_posts' ) );
- function function_pre_get_posts(){
- // you can't use the query->set here for tax_query
- // as tax query has already been made
- // so you need to need add youself to any
- // existing tax query
- $tax_query = array(
- 'taxonomy' => 'tax_name',
- 'field' => 'slug',
- 'terms' => 'term_name',
- 'operator'=> 'IN' );
- $query->tax_query->queries[] = $tax_query;
- $query->query_vars['tax_query'] = $query->tax_query->queries;
- }
Add Comment
Please, Sign In to add comment