cmb2_bootstrap

Function to encapsulate the CMB2 bootstrap process.

Description

cmb2_bootstrap(); 

Usage

  1. if ( !function_exists( 'cmb2_bootstrap' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'cmb2/bootstrap.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = cmb2_bootstrap(); 
  7.  

Defined (1)

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

/bootstrap.php  
  1. function cmb2_bootstrap() { 
  2.  
  3. if ( is_admin() ) { 
  4. /** 
  5. * Fires on the admin side when CMB2 is included/loaded. 
  6. * In most cases, this should be used to add metaboxes. See example-functions.php 
  7. */ 
  8. do_action( 'cmb2_admin_init' ); 
  9.  
  10. /** 
  11. * Fires when CMB2 is included/loaded 
  12. * Can be used to add metaboxes if needed on the front-end or WP-API (or the front and backend). 
  13. */ 
  14. do_action( 'cmb2_init' ); 
  15.  
  16. /** 
  17. * For back-compat. Does the dirty-work of instantiating all the 
  18. * CMB2 instances for the cmb2_meta_boxes filter 
  19. * @since 2.0.2 
  20. */ 
  21. $cmb_config_arrays = apply_filters( 'cmb2_meta_boxes', array() ); 
  22. foreach ( (array) $cmb_config_arrays as $cmb_config ) { 
  23. new CMB2( $cmb_config ); 
  24.  
  25. /** 
  26. * Fires after all CMB2 instances are created 
  27. */ 
  28. do_action( 'cmb2_init_before_hookup' ); 
  29.  
  30. /** 
  31. * Get all created metaboxes, and instantiate CMB2_hookup 
  32. * on metaboxes which require it. 
  33. * @since 2.0.2 
  34. */ 
  35. foreach ( CMB2_Boxes::get_all() as $cmb ) { 
  36. if ( $cmb->prop( 'hookup' ) ) { 
  37. $hookup = new CMB2_hookup( $cmb ); 
  38.  
  39. /** 
  40. * Fires after CMB2 initiation process has been completed 
  41. */ 
  42. do_action( 'cmb2_after_init' );