acf/settings/enable_datastore
Enables the ACF datastore, which integrates ACF fields with Gutenberg’s native wp.data store. When enabled, ACF field values are saved through WordPress’s REST API instead of the legacy metabox AJAX request.
The datastore unlocks several capabilities:
- Full revision support for ACF fields
- Autosave integration
- JavaScript API via
wp.data.select('acf/fields')andwp.data.dispatch('acf/fields') - Live preview and editing for block bindings
This filter requires WordPress 6.7 or later.
Changelog
- Added in version 6.8.1
Parameters
This filter has no additional parameters. Return true to enable, false to disable.
Example
Enable the datastore for all posts:
add_filter( 'acf/settings/enable_datastore', '__return_true' );
Enable conditionally for specific post types:
add_filter( 'acf/settings/enable_datastore', function( $enabled ) {
// Only enable for products and pages
$post_type = get_post_type();
if ( in_array( $post_type, array( 'product', 'page' ) ) ) {
return true;
}
return $enabled;
});
Disable after previously enabling (useful for troubleshooting):
add_filter( 'acf/settings/enable_datastore', '__return_false', 100 );
Notes
- The datastore is disabled by default
- Currently available in ACF PRO only
- Custom JavaScript hooked into ACF’s legacy metabox save events may need to be updated to work with Gutenberg’s REST save flow
- We recommend testing thoroughly in a staging environment before enabling on production sites
Related
- Using the ACF Datastore – Full guide to the datastore feature
- Block Bindings – Using ACF fields with WordPress block bindings
这篇文档对你有帮助吗?
谢谢你的反馈!