cmb2_can_save

The CMB2 cmb2 can save hook.

Description

Parameters (1)

0. $this_cmb_prop_save_fields_isset_post_this_cmb_nonce_wp_verify_nonce_post_this_cmb_nonce_this_cmb_nonce_defined_doing_autosave_doing_autosave_type_in_array_type_this_cmb_prop_object_types_is_multisite_ms_is_switched (unknown) => ( $this->cmb->prop( 'save_fields' ) && isset( $_POST[ $this->cmb->nonce() ] ) && wp_verify_nonce( $_POST[ $this->cmb->nonce() ], $this->cmb->nonce() ) && ! ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) && ( $type && in_array( $type, $this->cmb->prop( 'object_types' ) ) ) && ! ( is_multisite() && ms_is_switched() ) )
The this cmb prop save fields isset post this cmb nonce wp verify nonce post this cmb nonce this cmb nonce defined doing autosave doing autosave type in array type this cmb prop object types is multisite ms is switched.

Usage

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

Defined (1)

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

/includes/CMB2_hookup.php  
  1. return apply_filters( 'cmb2_can_save', (