Forums Forums Search & Filter Pro Allow Blank Range Field

Viewing 3 posts - 1 through 3 (of 3 total)
  • Anonymous
    #184484

    I have a range field with number inputs. I’ve figured out how to empty the default values out using the ‘sf_input_object_pre’ filter. However, when doing this I get 0 search results upon submitting the form. Basically, I’d like for this field to be optional. How can I achieve this?

    Anonymous
    #184487

    Some more info…the number inputs are a custom meta field. I’m trying to debug this by viewing the $query data in the results template. The fields I’m using are nowhere to be found in the query vars.

    Trevor
    #184506

    In the current version of the plugin, a range field excludes all posts that have no meta data for that meta key (WordPress doesn’t have meta keys with empty values on posts, it does not have that meta key at all for the post.

    If you manually set defaults (From and To) that are above and below the actual values, you then need to use our Edit Query Arguments filter to remove that field from the arguments by testing what values are there to look for both of those default values.

    It might also be possible to edit the URL to look for the part of the string that is the default for that field, and remove it. Both of these filters are detailed here:

    https://searchandfilter.com/documentation/action-filter-reference/

    I might be inclined to try the URL route first. You can try it yourself. Do the search and then manually edit the URL in the browser to remove that part.

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