Home Forums Front-end Issues Parametric search on layout fields


Parametric search on layout fields

  • I’m still in the early stages of a project where I’m trying to gather information before committing to various ACF set ups.

    The project involves a rather large and complex ACF form on a CPT, which will then be searchable by an advanced search field on the front end, where people can filter by various parameters.

    To help make the form more user friendly on the back end I would like to use both flexible content and repeater fields (in fact, I have to use a repeater in some parts).

    What I can’t work out is whether the data in these field types are searchable via an advanced search system be it via a plugin (eg Search and Filter Pro or FacetWP) or via a custom made advanced search system.

    Is it possible to create filtered search that searches the inside both flexible content and repeater fields?

  • The data in checkbox, multiselect, relationship, repeater and flex fields is not easily searchable. The first 3 store data in serialized arrays and the last 2 store data across several fields with slightly different meta_key values that can get quire complex depending how how deeply they are nested.

    Because of this there are two choices that I’ve found.

    1) A plugin and maybe an add on that is specifically designed to search this type of data
    2) Converting the data to as easily searchable storage method, I.E. in the way WP stores meta data across multiple database rows with the same meta_key.

    I have not found anything that I’m satisfied with that fits #1 and I’ve been looking for a long time.

    2 is the easier method. You can create a save post hook that takes the data from these fields and stores them into a hidden custom field (starts with an underscore) and then search these fields instead of trying to search ACF fields directly. I’ve actually been inspired by the filters in one search tool to build a converter plugin.

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

The topic ‘Parametric search on layout fields’ is closed to new replies.