Home › Forums › Front-end Issues › Parametric search on layout fields › Reply To: Parametric search on layout 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.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
Are you building WordPress sites with ACF and @BeaverBuilder, and wanted to use your ACF Blocks in both the block editor and Beaver Builder?— Advanced Custom Fields (@wp_acf) May 10, 2023
The BB team recently added support for using ACF Blocks in Beaver Builder. Check it out 👇https://t.co/UalEIa5aQi
© 2023 Advanced Custom Fields.