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

You could for example use in_array. Like so,

if ( ! in_array( $post_type, array( 'region', 'region2', 'region3' ) ) ) {
// something

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.