Home Forums General Issues Searching Multiple Fields (city + state)


Searching Multiple Fields (city + state)

  • Hello all,

    was hoping someone would point me in the right direction on how to accomplish this. I looked at the paid plugins, and I don’t think any of them will accomplish this.

    I am trying to search some of the custom fields I’ve created for data and display them on a page. The problem I’m having with this is, if you search for the city and state, results won’t turn. I currently have city setup as it’s on text box field, and state setup as a dropdown field. For example, if I search for Atlanta, it will display posts with Atlanta entered in as the city. If I search for Georgia, it will display posts with Georgia entered in as the State. If I search for “Atlanta, Georgia” or “Atlanta Georgia” (without ,), it will not pull any posts since they are separate fields.

    The solutions I have come up this far are as follows:

    1) Make the city/state fields one single text box field, so the admin will need to manually enter in all states instead of choosing a drop down box.

    2) Make changes to the WordPress search function to make it search multiple fields at once. (No clue how to even begin doing this).

    I’d rather not do #1, and would like the admin user to be able to enter a state in separately then the city. I am just having trouble accomplish this. Any ideas?

  • Might look at a plugin such as which can generate an index that includes all custom fields, do fuzzy matching, etc. In the configuration you can set it to look at all custom fields which should do what you’re looking for.

    By default the plugin will upgrade the built-in search, but you can also use it in custom searches/queries if you need to as well.

  • Did you ever figure this out? I can get the multi query to work but I cannot seem to get the meta values in a drown down to query it.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.