Set a conditional argument for multiple Custom Post Types in WordPress

WP Beaches ~
You can set a conditional argument for multiple custom post types in WordPress using in_array
The format is like so…
if( in_array( get_post_type(), array(‘treatment’, ‘package’)) ) {//add in cpts here // do stuff } else {//what all the other post types get // do other stuff } }
It searches the array of cpts to see if they belong
Leave a Reply