Forums › Forums › Search & Filter Pro › Filter custom field with comma separated values
- This topic has 4 replies, 2 voices, and was last updated 9 years, 1 month ago by
Trevor.
-
Anonymous(Private) February 15, 2017 at 8:15 pm #90489
Hi there,
Just purchased a license for this plugin as it’ll handle a big chunk of the filtering / display of the data on my site.
I have only found one issue so far…
I have a few custom fields which contain comma separated values. I’d like to use a multi-select to allow users to select between these values, but currently I can only get the plugin to do exact comparison on the custom field value. So I’d like a post with a field such as “Value1,Value2,Value3” to appear in results when “Value1” is selected in the multi-select.
Cheers!
Anonymous(Private) February 16, 2017 at 2:08 pm #90634They were created using ACF, yes. They are just normal text fields however. So is it just a matter of recreating those data fields as an array type? I’d love to find a way of parsing the current data set, as there’s around 1500 posts with these fields set.
When I have dealt with WP Query before, it was just a matter of setting a compare operator to ‘LIKE’ in the meta query. Is there a way I can modify the query such that the operator for these 2 fields is LIKE instead of ‘==’?Thanks!
Anonymous(Private) February 16, 2017 at 2:41 pm #90639Thanks!
I’ve setup a test field using the Select field type, which produces the results I’m looking for!
I’ll create a small migration script to move the comma separated text fields over to these Select fields.
Thanks again for your time and expertise, Trevor!
-
AuthorPosts