cmb2_override_meta_save

Filter whether to override saving of meta value.

Description

apply_filters( 'cmb2_override_meta_save', (null) $null, (array) $a, (array) $this_args, (CMB2_Field) $instance ); 

Returning a non-null value will effectively short-circuit the function.

Parameters (4)

0. $null (null) => null
Whether to allow updating metadata for the given type.
1. $a (array)
2. $this_args (array)
All field arguments
3. $instance (CMB2_Field)
Object $field This field object

Usage

To run the hook, copy the example below.
  1. $null = apply_filters( 'cmb2_override_meta_save', $null, $a, $this_args, $instance ); 
  2.  
  3. if ( !empty( $null ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the cmb2_override_meta_save callback 
  2. function filter_cmb2_override_meta_save( $null, $a, $this_args, $instance ) { 
  3. // make filter magic happen here... 
  4. return $null
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'cmb2_override_meta_save', 'filter_cmb2_override_meta_save', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'cmb2_override_meta_save', 'filter_cmb2_override_meta_save', 10, 4 ); 

Defined (1)

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

/includes/CMB2_Field.php  
  1. $override = apply_filters( 'cmb2_override_meta_save', null, $a, $this->args(), $this );