Support

Account

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 😉