Forums › Forums › Search & Filter Pro › Help with WP_Query not working
- This topic has 32 replies, 2 voices, and was last updated 7 years, 1 month ago by
Anonymous.
-
Trevor(Private) March 23, 2018 at 12:26 pm #167941
It looks like your theme is not searching in the testimonials CPT. If I do this search:
https://voxscientia.eu/?s=scipost
Not results are found either, but searching for data or digital finds only the home page.
Maybe you could add Relevanssi (free version) and set that up to search the testimonials CPT? Build the index then enable to setting in the S&F form Advanced settings.
Trevor(Private) March 23, 2018 at 1:39 pm #167961Taking a step backwards, if you use a plugin like CPT UI and create a test post type (making sure it is set to be visible to WP Search), make a post in it, and do a standard WP search, does the theme find it? If not, try switching to 2016 theme and test.
Trevor(Private) March 23, 2018 at 2:09 pm #167981I wrote this little bit of code, which would do it:
function dontsearchCPTs($query) { if ($query->is_search) { $query->set('post_type', 'post'); } return $query; } add_filter('pre_get_posts','dontsearchCPTs');
That would stop search looking at anything other than plain posts. I guess there might be other ways.
-
AuthorPosts