Skip to content

Instantly share code, notes, and snippets.

@hivepress
Created February 20, 2023 21:17
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save hivepress/e516899262d31d83f2b9d907bf36ebd9 to your computer and use it in GitHub Desktop.
Make the location field required in the listing search form #hivepress #geolocation
<?php
add_filter(
'hivepress/v1/forms/listing_search',
function( $form ) {
if ( isset( $form['fields']['location'] ) ) {
$form['fields']['location']['required'] = true;
}
return $form;
},
1000
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment