Linux 软件免费装
Banner图

Places Autocomplete for ACF

开发者 ciricdev
更新时间 2026年11月13日 07:02
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

address acf google maps autocomplete places api

下载

1.0.0

详情介绍:

The Google Map field in Advanced Custom Fields (ACF) uses Google's legacy Places API for its address search. Since March 1, 2025, Google no longer lets new Google Cloud projects enable the legacy Places API. If your API key comes from a new project, the map loads, but as soon as you type an address nothing happens and the browser console shows: You're calling a legacy API, which is not enabled for your project ... LegacyApiNotActivatedMapError This plugin fixes that without changing your fields or your saved data: No settings page. Activate it and the field works. Requirements This plugin is not affiliated with or endorsed by WP Engine (ACF) or Google.

安装:

  1. Upload the places-autocomplete-for-acf folder to /wp-content/plugins/, or install it from Plugins > Add New.
  2. Activate the plugin.
  3. In Google Cloud Console, make sure Maps JavaScript API, Geocoding API and Places API (New) are enabled for the API key ACF uses. If the key has "API restrictions", add these three APIs to the list.
  4. Open a post with an ACF Google Map field and start typing an address.

屏幕截图:

  • Without this plugin: with an API key from a new Google Cloud project, the ACF Google Map field shows "This page can't load Google Maps correctly" when you search for an address.

升级注意事项:

1.0.0 Initial release.

常见问题:

Do I need this plugin?

You need it if typing in the ACF Google Map search box shows no suggestions and the browser console shows LegacyApiNotActivatedMapError. This usually happens with API keys from Google Cloud projects created after March 1, 2025. If your project still has the legacy Places API enabled, the field already works, but this plugin moves it to the newer API.

Will my existing map values change?

No. Existing values are not touched. New selections are saved in the same format ACF uses.

I see a red message under the search box. What does it mean?

Google rejected the request, and the message says why. The most common causes are:

  • Places API (New) is not enabled in the Google Cloud project that owns the key.
  • The key has API restrictions that do not include Places API (New).
  • The key's website restrictions do not include your admin domain.
After changing settings in Google Cloud Console, wait a few minutes and reload the page.

I still see an error in the console.

Check that Places API (New) is enabled for the project that owns the key, and that the key's website restrictions include your admin domain. Errors from this plugin start with [Places Autocomplete for ACF].

Can I limit suggestions to one country?

Yes, with the ciricdev_paacf_settings filter: add_filter( 'ciricdev_paacf_settings', function ( $settings ) { $settings['includedRegionCodes'] = array( 'us' ); return $settings; } ); Available keys: minChars (default 3), debounce in milliseconds (default 250), includedRegionCodes (up to 15 two-letter codes), language (default: site language).

Can I change the request in JavaScript?

Yes. Use the ciricdev_paacf_request ACF JS filter to adjust the Places API (New) autocomplete request, and the ciricdev_paacf_place_selected action to react when a place is chosen: acf.addFilter( 'ciricdev_paacf_request', function ( request, field, map ) { request.includedPrimaryTypes = [ 'street_address' ]; return request; } );

Does it work with ACF PRO?

Yes. It works with both the free and PRO versions of ACF.

更新日志:

1.0.0