Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active February 1, 2021 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tripflex/2ef5dd808ea374f28267f5f1af7feb35 to your computer and use it in GitHub Desktop.
Save tripflex/2ef5dd808ea374f28267f5f1af7feb35 to your computer and use it in GitHub Desktop.
Customize Google Auto Complete field options when using WP Job Manager Field Editor
<?php
add_filter( 'job_manager_field_editor_autocomplete_field_options', 'smyles_custom_autocomplete_options', 10, 4 );
function smyles_custom_autocomplete_options( $options, $key, $args, $field ){
// @see https://developers.google.com/places/supported_types
$options['types'] = array( '(cities)' );
// @see https://developers.google.com/maps/documentation/javascript/places-autocomplete
// @see https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
$options['componentRestrictions'] = array(
'country' => 'AT'
);
return $options;
}
@franky1219
Copy link

was looking for this one for a while. working fine!

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