acf/load_value/<key>=<key>
The Advanced Custom Fields acf load value key hook.
Description
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.
- $value = apply_filters( 'acf/load_value/{$key}={$key}', $value, $post_id, $field );
- if ( !empty( $value ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the acf/load_value/<key>=<key> callback
- function filter_acf_load_value_key_key( $value, $post_id, $field ) {
- // make filter magic happen here...
- return $value;
- };
- // add the filter
- add_filter( "acf/load_value/{$key}={$key}", 'filter_acf_load_value_key_key', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( "acf/load_value/{$key}={$key}", 'filter_acf_load_value_key_key', 10, 3 );
Defined (1)
The filter is defined in the following location(s).
- /core/fields/_functions.php
- $value = apply_filters('acf/load_value/' . $key . '=' . $field[ $key ], $value, $post_id, $field); // new filter