diff --git a/wp-disable-posts.php b/wp-disable-posts.php index 8ca5d82..26a32b4 100644 --- a/wp-disable-posts.php +++ b/wp-disable-posts.php @@ -143,11 +143,15 @@ public static function check_post_type( $posts = array() ) */ public static function remove_from_search_filter( $query ) { - if ( !is_search() ) { + if ( !is_search() || !$query->is_main_query() ) { return $query; } - $post_types = get_post_types(); + $post_types = get_post_types( + array( + 'exclude_from_search' => false + ) + ); if ( array_key_exists('post', $post_types) ) { /* exclude post_type `post` from the query results */