i'm trying to add a taxonomy filter on multiple CPT linked to this taxonomy.
i'm good for 1 cpt at a time, but i'm definitly sure i can do much easyier with one function for all cpt.
actually i have cpt "region", and i wish to add more like "region2", "region3", how can i do this ?
my code :
if ( 'region' !== $post_type )
// xxx
endif;
i'm trying to add a taxonomy filter on multiple CPT linked to this taxonomy.
i'm good for 1 cpt at a time, but i'm definitly sure i can do much easyier with one function for all cpt.
actually i have cpt "region", and i wish to add more like "region2", "region3", how can i do this ?
my code :
if ( 'region' !== $post_type )
// xxx
endif;
You could for example use in_array
. Like so,
if ( ! in_array( $post_type, array( 'region', 'region2', 'region3' ) ) ) {
// something
}