Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created April 27, 2022 09:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hivepress/60359efea8625760d5c63798e4307124 to your computer and use it in GitHub Desktop.
Save hivepress/60359efea8625760d5c63798e4307124 to your computer and use it in GitHub Desktop.
Make the location field optional for listings #hivepress #geolocation
<?php
add_filter(
'hivepress/v1/models/listing/attributes',
function( $attributes ) {
if ( isset( $attributes['location'] ) ) {
$attributes['location']['edit_field']['required'] = false;
}
return $attributes;
},
1000
);
@umoekagodman
Copy link

Can it be made optional depending on the selected category instead of globally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment