Created
February 10, 2018 16:31
-
-
Save juanmafla/8a4596ca3ad55790530845aa0236060e to your computer and use it in GitHub Desktop.
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
| function exclude_sub_units($query) { | |
| if(!is_admin() || wp_doing_ajax() ) { | |
| if($query->get('post_type') == 'estate_property') { | |
| $meta_query = $query->get('tax_query'); | |
| $meta_query[]= array( | |
| 'relation' => 'AND', | |
| array( | |
| 'taxonomy' => 'subunits', | |
| 'field' => 'slug', | |
| 'terms' => 'subunit', | |
| 'operator' => 'NOT IN' | |
| ) | |
| ); | |
| $query->set( 'tax_query', $meta_query); | |
| //$query->set( 'post__not_in', array(19259,19500,19504) ); | |
| } | |
| } | |
| } | |
| add_action( 'pre_get_posts', 'exclude_sub_units' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment