cmb2_show_on

Filter to determine if metabox should show.

Description

apply_filters( 'cmb2_show_on', (array) $show, (mixed) $this_cmb_meta_box, (mixed) $this_cmb ); 

Default is true

Parameters (3)

0. $show (array)
Default is true, show the metabox
1. $this_cmb_meta_box (mixed)
Array of the metabox arguments
2. $this_cmb (mixed)
The CMB2 instance

Usage

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

Defined (2)

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

/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/CMB2_hookup.php  
  1. $show = (bool) apply_filters( 'cmb2_show_on', $show, $this->cmb->meta_box, $this->cmb ); 
/includes/libraries/metabox/includes/CMB2_hookup.php  
  1. $show = (bool) apply_filters( 'cmb2_show_on', $show, $this->cmb->meta_box, $this->cmb );