cf_custom_fields_pre_save_meta_key_metabox
Filter value before saving using to metabox processor.
Description
Parameters (3)
- 0. $value (mixed)
- The value to be saved
- 1. $slug (string)
- Slug of field
- 2. $post_id (int)
- The post id.
Usage
- To run the hook, copy the example below.
- $value = apply_filters( 'cf_custom_fields_pre_save_meta_key_metabox', $value, $slug, $post_id );
- if ( !empty( $value ) ) {
- // everything has led up to this point...
- }
- The following example is for adding a hook callback.
- // define the cf_custom_fields_pre_save_meta_key_metabox callback
- function filter_cf_custom_fields_pre_save_meta_key_metabox( $value, $slug, $post_id ) {
- // make filter magic happen here...
- return $value;
- };
- // add the filter
- add_filter( 'cf_custom_fields_pre_save_meta_key_metabox', 'filter_cf_custom_fields_pre_save_meta_key_metabox', 10, 3 );
- To remove a hook callback, use the example below.
- // remove the filter
- remove_filter( 'cf_custom_fields_pre_save_meta_key_metabox', 'filter_cf_custom_fields_pre_save_meta_key_metabox', 10, 3 );
Defined (1)
The filter is defined in the following location(s).
- /includes/metabox.php
- $value = apply_filters( 'cf_custom_fields_pre_save_meta_key_metabox', $value, $slug, $post->ID );