Search not finding CPT content?

At this following staging URL: - We have a sage theme that for some reason won’t allow for searching of CPTs. We tried a number of things, including adding multiple advanced searching plugins but nothing seems to allow for the searching of CPT content.

For example, a search for “Concussions” should bring up a search results page that references the most recent blog post (which is currently being pulled from a CPT for other reasons I won’t get in to).

Anyone have issues with this and what can we do to resolve this?

How are you currently attempting to include the sports CPT in your search results?

We’ve tried:

Search Everything:

and Relevanssi:

I also believe that I remember reading somewhere that we shouldn’t even need to use these because of Sage’s default search already allowing for this?

Here’s the CPT that we are trying to index:

Any additional insight would be greatly appreciated.

Are you able to find the CPT content without a plugin? Without ruling out issues with those plugins it’s difficult to determine whether this is Roots related, plugin related, or just a general WP support issue.

Sage doesn’t add anything for CPT’s or searches, so this is incorrect.

With the plugins disabled, this doesn’t work either.

What I mean is, are you able to try adding the CPTs to your search query without a plugin to verify that there’s an issue with Sage?

If i’m understanding correctly, you’re asking if we have the CPT “query_var” set to “true”? We are currently using the CPT UI plugin to make the CPT. Within that plugin, the query_var option is set to true:

There’s also this option:

Which is set to “false”.

You’re not understanding correctly.

Try adding the CPT to a search query to narrow down whether it’s an issue with Sage.

1 Like

Thanks guys! This helped point me in the right direction on this one. It appears that a developer, somewhere along the way, added this to the functions.php file:

function SearchFilter($query) {
  if ($query->is_search) {
    $query->set('post_type', 'post');
  return $query;

That might explain it :wink: - All fixed now. Thanks guys, definitely wasn’t a Sage specific issue on this one.

1 Like

was dealing with the same thing. thanks for sharing.