Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created April 27, 2022 09:54
Show Gist options
  • Select an option

  • Save hivepress/60359efea8625760d5c63798e4307124 to your computer and use it in GitHub Desktop.

Select an option

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
Copy Markdown

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