Exclude multiple custom post types from search
This is because elseif doesn’t work the way you think it does. You’re trying to use it in a way that’s closer to a switch statement or multiple if statement` This: if (post_type_exists(‘videos’)) { // exclude from search results $wp_post_types[‘videos’]->exclude_from_search = true; } elseif (post_type_exists(‘coordinator’)) { // exclude from search results $wp_post_types[‘coordinator’]->exclude_from_search = true; } … Read more