I'm working in a site that allows to search for lawsuits about medical malpractice, the client wants to have a search form almost equal to the one in this site:


All the information is stored in custom post types with custom fields, including the lawsuit, hospital and the doctor record.

I looked around for plugins but most of the advanced plugins I found are for custom taxonomies filters and not custom fields and some have the ability to search in custom fields but with only one input in the form instead of separated inputs for each possible field to search.

Is there a plugin that can achieve this layout and behaviour? If there is not what could be my best approach in creating this search form? I have never modified the wordpress search before.

We are using advanced custom fields plugin.

1 Answer 1


Custom fields are stored in post metadata, which is very expensive (slow) to query. Ideally, you would be better off re-coding the site to use custom taxonomies instead of custom fields. From there, search would be easier.

If you stick with ACF or other metadata, you can customize the search form and queries, but you'll be putting a lot of load on the server. At that point, it would be preferable to add a search service such as ElasticSearch or Swiftype. The client would pay for this monthly or annual service, but they'd be able to do all sorts of filtering and sorting without as much custom code, and everything would load much faster because you would then be querying an external service rather than the WP database.

  • I understand what you mean but some of the required queries like dates, numbers and relations cannot be solved with taxonomies so I will need the metadata, I will check the search services but this client has a limited budget so I might end up looking for something else. Thanks.
    – jeruki
    May 8, 2018 at 21:55
  • 1
    Depending on their host they may have to up their hosting package in order to allow meta queries to work. Basically you need to set up a form that then queries posts like this: advancedcustomfields.com/resources/query-posts-custom-fields
    – WebElaine
    May 9, 2018 at 13:34
  • I'm creating the form and submitting the data to try this right now, I will post back with results.
    – jeruki
    May 9, 2018 at 21:48
  • 1
    You might also want to look into the Relevanssi plugin to see if it will search the fields you need.
    – WebElaine
    May 9, 2018 at 21:57
  • I actually made a plugin just like this with ajax. The link was here: wordpress.stackexchange.com/questions/385772/…. That should get you going in the right direction.
    – rudtek
    Nov 4, 2021 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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