acf_get_local_store()
Returns either local store or a dummy store for the given name or post type.
No Hooks.
Returns
ACF_Data.
Usage
acf_get_local_store( $name, $post_type );
- $name(string)
- The store name.
Default:'' - $post_type(string)
- The post type for the desired store.
Default:''
Changelog
| Since 5.7.10 | Introduced. |
acf_get_local_store() acf get local store code ACF 6.8.8
function acf_get_local_store( $name = '', $post_type = '' ) {
if ( '' !== $post_type ) {
switch ( $post_type ) {
case 'acf-post-type':
$name = 'post-types';
break;
case 'acf-taxonomy':
$name = 'taxonomies';
break;
case 'acf-field-group':
$name = 'groups';
break;
case 'acf-field':
$name = 'fields';
break;
case 'acf-ui-options-page':
$name = 'ui-options-pages';
break;
}
}
if ( acf_is_local_enabled() && '' !== $name ) {
return acf_get_store( "local-$name" );
} else {
// Return dummy store if not enabled or no name provided.
return acf_get_store( 'local-empty' );
}
}