Support Forums

The forums are closed and will be removed when we launch our new site.

Looking for support? You can access the support system via your account.

Forums Forums Search & Filter Pro Change Search to query an ACF custom field

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Dayne Coulson-Hoffacker
    #253261

    Hi,

    We have a custom post type called ‘councils’. We are assigning multiple postcodes to each of these entries. Example: 3033,3101,3002 etc. These are entered in an ACF custom field called ‘post_codes’ that is a textarea type field and are separated by a comma. See screenshot here:

    https://snipboard.io/QxmauH.jpg

    On the front end, we have the search form showing to search by Postcode. Screenshot here:

    https://snipboard.io/jcx6VJ.jpg

    Is there a way to change the query to search by that ACF field. For example, if I search for 3033 in the search field and click search I need it to show results that contain that postcode and not any of the titles etc.

    Hoping someone can help me out.

    Thanks so much,
    Dayne

    Trevor Moderator
    #253298

    If you were to use the Text search box to search that field, it would work.

    Our plugin does not directly allow you to do text searches of individual Post Meta (custom fields) and Taxonomy (Category, Tags and Taxonomies) data/terms. The Search & Filter Pro Text Search field uses the standard WordPress search, so looks only in the Post Title and Content. To help you control this better, on the form’s Advanced settings tab you will see 2 settings for Relevanssi.

    The documentation for this is here:

    https://www.designsandcode.com/documentation/search-filter-pro/3rd-party/relevanssi/

    You would need to install and activate the free Relevanssi plugin as well.

    Then set Relevanssi up and build its index (make sure it is indexing the desired post types, custom fields AND any taxonomy that you want to search).

    You can have only one Text search field per form, and one form per page. So, you can’t have multiple boxes to each search a different custom field.

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

The forum ‘Search & Filter Pro’ is closed to new topics and replies.