There are tutorials that explain how to limit a search to a specific category.

My question is, is there a way to configure wordpress' search to, within a custom post type, search for a custom field value.

So for example, if I search for "hello", the results would come up with posts that have a certain custom field equal to "hello". The certain post would also be a certain custom post type.

Any help is appreciated.

  • You can try building a custom search. Aug 10 '11 at 6:42

Have you tried adding this hidden field to the search form?

<input type="hidden" name="post_type" value="news" /> 

For value="", you should include the name of your custom post type, of course.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.