# How to make Location field optional for specific listing categories?

**URL:** <https://community.hivepress.io/t/how-to-make-location-field-optional-for-specific-listing-categories/17322>\
**Category:** Geolocation\
**Created:** [January 5, 2026, 2:19pm UTC](https://community.hivepress.io/t/how-to-make-location-field-optional-for-specific-listing-categories/17322 "2026-01-05T14:19:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mart](https://community.hivepress.io/letter_avatar_proxy/v4/letter/m/e47774/32.png) [@Mart](https://community.hivepress.io/u/Mart)\
**Post date:** [January 5, 2026, 2:19pm UTC](https://community.hivepress.io/t/how-to-make-location-field-optional-for-specific-listing-categories/17322/1 "2026-01-05T14:19:36Z")

</div>

Hello,

I’m using HivePress with the Geolocation extension and I need help with making the Location field **optional for specific listing categories**.

**My requirement:** I have some listing categories where Location should be **optional** (not required), while for other categories it should remain **required**.

**What I’ve tried:** I attempted to use various HivePress filters in my child theme:

add\_filter(‘hivepress/v1/forms/listing\_submit’, ‘my\_function’, 1000);  
add\_filter(‘hivepress/v1/forms/listing\_update’, ‘my\_function’, 1000);  
add\_filter(‘hivepress/v1/forms/listing\_submit/errors’, ‘my\_function’, 1000);  
add\_filter(‘hivepress/v1/models/listing/attributes’, ‘my\_function’, 1000);

I was able to:

- Hide the Location field using JavaScript for the specified categories

- Add “(optional)” label to the field

- Remove the `required` attribute from the form field

**The problem:** Despite all these modifications, when submitting a listing without Location in these categories, I still get the validation error: **“Location” field is required.**

It seems the Geolocation extension has its own validation that runs regardless of the form field settings.

**My questions:**

1. Is there a proper hook or filter to make the Location field optional for specific categories?

2. Is there a way to disable the Geolocation extension’s validation for certain categories?

3. Can this be configured in the settings without custom code?

I would appreciate any guidance on the correct approach to implement this.

Thank you!

---

<div class="post-metadata">

**Author:** ![ChrisB](https://community.hivepress.io/user_avatar/community.hivepress.io/chrisb/32/14185_2.png) [@ChrisB](https://community.hivepress.io/u/ChrisB)\
**Post date:** [January 5, 2026, 5:03pm UTC](https://community.hivepress.io/t/how-to-make-location-field-optional-for-specific-listing-categories/17322/2 "2026-01-05T17:03:37Z")

</div>

Hi @Mart,

This snippet will make the location field optional for listings. It may suit your needs, as is, or you can try restricting it to only certain categories by extending the code.

- [Make the location field optional for listings #hivepress #geolocation · GitHub](https://gist.github.com/hivepress/60359efea8625760d5c63798e4307124)

I hope this helps!

Cheers,  
Chris ✌

---

<div class="post-metadata">

**Author:** ![system](https://community.hivepress.io/user_avatar/community.hivepress.io/system/32/13990_2.png) [@system](https://community.hivepress.io/u/system)\
**Post date:** [February 4, 2026, 5:04pm UTC](https://community.hivepress.io/t/how-to-make-location-field-optional-for-specific-listing-categories/17322/3 "2026-02-04T17:04:15Z")

</div>

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