Skip to main content
1 of 2
gokujou
  • 101
  • 2

Need to search a custom field (ingredients, one long string per post), but want it to allow phrases/non-exact matches

So I have a complex list of ACF repeaters for ingredients, but have a save hook to store them all as one comma delimited text string in a custom field to help. My current "advanced" search passes ingredient searches as a meta query and works, but non-exact matches return nothing. Like if you search "pepper and paprika" it fails.

Is there a way to make a meta query work like a normal query a little bit more?

My meta_query:

    $args['meta_query'] = array(
        array(
            'key' => 'ingredient_list',
            'value' => $search_query,
            'compare' => 'LIKE',
        )
    );

Thank you for any help!

gokujou
  • 101
  • 2