Home › Forums › ACF PRO › Fix: Include ACF fields content in WP Search › Reply To: Fix: Include ACF fields content in WP Search
@marvinlerouge: The enhanced database query searchs for post meta keys, that have the searchphrase as a value. As far as I can see, this would work with repeater fields as well:
$where .= " (meta_key LIKE '%" . $searcheable_acf . "%' AND meta_value LIKE '%$tag%') ";
let’s assume you have a repeater named ‘my_field’. In the Database, you will find entries like my_field_0_repeaterfieldname, my_field_1_repeaterfieldname, etc. So if you add either ‘my_field’ or ‘repeaterfieldname’ to the $list_searcheable_acf array, the above query will resolve i.e. to:
$where .= " (meta_key LIKE '%myfield%' AND meta_value LIKE '%$searchphrase%') ";
But as I stated before, I am by no means a real coder 😉
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.