Skip to content

Instantly share code, notes, and snippets.

@corsonr
Created October 13, 2012 09:54
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corsonr/3884007 to your computer and use it in GitHub Desktop.
Save corsonr/3884007 to your computer and use it in GitHub Desktop.
Add CPTs to search
@diegoborba
Copy link

Very good!

@forkbombe
Copy link

forkbombe commented Jan 2, 2018

I found using the builtin function is_search() was creating problems for other queries that are being run in some cases (in my case it was a pre-build theme).

Using the method is_search attached to the $query object works fine.

if($query->is_search() { // stuff }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment