Forums Forums Search & Filter Pro Filter custom field with comma separated values

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #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!

    Trevor
    #90538

    In effect, those fields are holding arrays, yes? How were they created? We support multi value (array) fields IF they were created in ACF.

    Anonymous
    #90634

    They 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
    #90639

    Thanks!

    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!

    Trevor
    #90641

    Cool. I will close this thread for now then.

Viewing 5 posts - 1 through 5 (of 5 total)