acf/format_value_for_api/type=<type>

Format_value_for_api.

Description

apply_filters( 'acf/format_value_for_api/type=<type>', (unknown) $value, (unknown) $post_id, (unknown) $field ); 

@description: uses the basic value and allows the field type to format it or the api functions

Parameters (3)

0. $value (unknown)
The value.
1. $post_id (unknown)
The post id.
2. $field (unknown)
The field.

Usage

To run the hook, copy the example below.
  1. $value = apply_filters( 'acf/format_value_for_api/type={$type}', $value, $post_id, $field ); 
  2.  
  3. if ( !empty( $value ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the acf/format_value_for_api/type=<type> callback 
  2. function filter_acf_format_value_for_api_type_type( $value, $post_id, $field ) { 
  3. // make filter magic happen here... 
  4. return $value
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "acf/format_value_for_api/type={$type}", 'filter_acf_format_value_for_api_type_type', 10, 3 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "acf/format_value_for_api/type={$type}", 'filter_acf_format_value_for_api_type_type', 10, 3 ); 

Defined (1)

The filter is defined in the following location(s).

/core/fields/_functions.php  
  1. $value = apply_filters('acf/format_value_for_api/type=' . $field['type'], $value, $post_id, $field);