cmb2_override_<field_id>_meta_remove

Filter whether to override removing of meta value.

Description

apply_filters( 'cmb2_override_<field_id>_meta_remove', (null|bool) $override, (array) $a, (array) $this_args, (CMB2_Field) $instance ); 

The dynamic portion(s) of the hook refer to the current field id paramater. Returning a non-null value will effectively short-circuit the function.

Parameters (4)

0. $override (null|bool)
Whether to allow metadata deletion of the given type.
1. $a (array)
Array of data about current field including: type : Current object type id : Current object ID field_id : Current Field ID repeat : Whether current field is repeatable single : Whether to save as a single meta value
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. $override = apply_filters( 'cmb2_override_{$field_id}_meta_remove', $override, $a, $this_args, $instance ); 
  2.  
  3. if ( !empty( $override ) ) { 
  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_<field_id>_meta_remove callback 
  2. function filter_cmb2_override_field_id_meta_remove( $override, $a, $this_args, $instance ) { 
  3. // make filter magic happen here... 
  4. return $override
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "cmb2_override_{$field_id}_meta_remove", 'filter_cmb2_override_field_id_meta_remove', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "cmb2_override_{$field_id}_meta_remove", 'filter_cmb2_override_field_id_meta_remove', 10, 4 ); 

Defined (2)

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

/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/CMB2_Field.php  
  1. $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this ); 
/includes/libraries/metabox/includes/CMB2_Field.php  
  1. $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );