cmb2_save_field

Hooks after save field action.

Description

do_action( 'cmb2_save_field', (string) $field_id, (bool) $updated, (string) $action, (CMB2_Field) $instance ); 

Parameters (4)

0. $field_id (string)
The current field id paramater.
1. $updated (bool)
Whether the metadata update action occurred.
2. $action (string)
Action performed. Could be repeatable,, updated., or removed.
3. $instance (CMB2_Field)
Object $field This field object

Usage

To run the hook, copy the example below.
  1. // run the action 
  2. do_action( 'cmb2_save_field', $field_id, $updated, $action, $instance ); 
The following example is for adding a hook callback.
  1. // define the cmb2_save_field callback 
  2. function action_cmb2_save_field( $field_id, $updated, $action, $instance ) { 
  3. // make action magic happen here... 
  4. }; 
  5.  
  6. // add the action 
  7. add_action( 'cmb2_save_field', 'action_cmb2_save_field', 10, 4 ); 
To remove a hook callback, use the example below.
  1. // remove the action 
  2. remove_action( 'cmb2_save_field', 'action_cmb2_save_field', 10, 4 ); 

Defined (1)

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

/includes/CMB2_Field.php  
  1. do_action( 'cmb2_save_field', $field_id, $updated, $action, $this );