ACF_Local_JSON::get_save_paths
Gets the path(s) to save JSON to.
Method of the class: ACF_Local_JSON{}
Hooks from the method
Returns
Array.
Usage
$ACF_Local_JSON = new ACF_Local_JSON(); $ACF_Local_JSON->get_save_paths( $key, $post );
- $key(string)
- The key to get paths for (optional).
Default:'' - $post(array)
- The main ACF post array (optional).
Default:array()
Changelog
| Since 6.2 | Introduced. |
ACF_Local_JSON::get_save_paths() ACF Local JSON::get save paths code ACF 6.8.8
public function get_save_paths( $key = '', $post = array() ) {
$name = ! empty( $post['title'] ) ? (string) $post['title'] : '';
$post_type = acf_determine_internal_post_type( $key );
$paths = array();
// Paths are sorted by priority, with key overriding name, etc.
$paths[] = acf_get_setting( "save_json/key={$key}" );
$paths[] = acf_get_setting( "save_json/name={$name}" );
$paths[] = acf_get_setting( "save_json/type={$post_type}" );
$paths[] = acf_get_setting( 'save_json' );
$paths = array_values( array_filter( $paths ) );
/**
* Filters the paths used to save JSON.
*
* @since 6.2
*
* @param array $paths An array of the potential paths to save JSON to.
* @param array $post The ACF field group, post type, or taxonomy array.
* @return array
*/
return (array) apply_filters( 'acf/json/save_paths', $paths, $post );
}