Last active
February 1, 2021 03:49
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
was looking for this one for a while. working fine!