Exclude some post types and a specific category
-
Hi, I’m using the free version of SearchWP and I’m trying to modify the default WordPress search results to:
- Only include
post
andpage
post types - Exclude a specific post category (ID 10)
I tried the usual method via
pre_get_posts
, setting'post_type' => ['post', 'page']
and'cat' => -10
. This works fine in the normal search results, but in the Live Ajax Search, custom post types likeglossary
are still included in the search results.I also tried using the
the_posts
filter to manually remove any non-post/page items and exclude category 10, but it still doesn’t work – those CPTs continue to appear in results.I believe the plugin is overriding the query or injecting results in a way that bypasses these filters.
How can I ensure that SearchWP respects post type and category filtering in the free version?Thanks in advance!
- Only include
- You must be logged in to reply to this topic.