How can I remove custom filter from the search bar?

Hi there,

I have a strange issue where on my homepage, the search bar looks as I want it to, namely like so:

However, if I’m on https://domain.com/?_sort=&s=&post_type=hp_listing&latitude=&longitude=&_region=&_category=37&location= AND I choose a listing category to search in, another filter is added to the search bar:

I don’t want/need the “Min” and “Max” fields on the right-hand side, but I can’t figure out where they’re coming from or how to disable them. I’m guessing they’re from an attribute that has numeric values, but I checked all of them and none of them seem to be different from the others.

How can I remove that filter from the search bar?

Thanks and best

Hi,

Most likely, you have created a custom attribute in Listings > Attributes and marked it as searchable. I recommend checking its settings. Also, please check this doc How to add listing attributes - HivePress Help Center

​I hope this is helpful to you.

That’s probably right! I will check all attributes and remove the checkmark next to filterable. This will still allow users to use the attribute from the search filter section though, right?

So I tried your suggestion, but then the attributes are removed from the filter section on the left-hand side. I’m looking to remove it from the search bar, though. I noticed an option to make attributes searchable exists, but that doesn’t appear for any of my attributes.

To be more precise, it’s a date filter. This is what my settings for it look like:

And this is what it looks like in the filter bar (not on the homepage though, only on this page: https://domain.com/?_sort=&s=&post_type=hp_listing&latitude=&longitude=&_region=&_category=35&location=):

I would expect there to be an option called Searchable which I could untick to remove the date section from the search bar, but either I can’t seem to see it, so I’m guessing it should be a different setting?

I alerady tried removing “Page (secondary)”, but that didn’t change it.

Hi,

Please note that only the Searchable option displays attributes in the search bar. If you don’t see any attributes marked with this option, you probably added this attribute using a PHP snippet.

I checked all my snippets, but there isn’t one relating to the search bar. What else could be causing this and how can I remove it?

Hi,

Unfortunately, there are no other options, this can be added using attribute listing or code.

I was able to reproduce the problem by first creating an attribute of type Select, checking “Show in search form” (with Field type “Select”), and saving it… THEN changing the attribute type to Date and Search Field type to “Number Range”, and saving again.
Although changing the Field type removes the “Show in search form” checkbox, is seems that it remains in a checked state in the database, and HivePress interprets it as checked.
Now what you could try do to is change the Field type to show back the check box, uncheck it and save the attribute, then change back the settings to your liking.

@andril This sound like a bug. The checked state should be cleared when the checkbox is hidden.

To identify which attribute is causing this, inspect the search field in you browser. You would be looking for an input or select HTML element with an attribute name that matches an (HivePress) attribute name. (Yep, the HTML element attribute named ‘name’ with a value that matches the name of a HivePress attribute – it can be a tad confusing!)

Thanks biguenique, that makes sense! I was already able to remove the filter in the meantime (I’m afraid I forgot how I did that), but I’ll keep your solution in mind in case it reappears.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.