cmb2_metabox_form

Display a metabox form (or optionally return it) & save it on submission.

Description

cmb2_metabox_form( (mixed) $meta_box, (int) $object_id = 0, (array) $args = array() ); 

Parameters (3)

0. $meta_box (mixed)
Metabox config array or Metabox ID
1. $object_id — Optional. (int)
The object id.
2. $args — Optional. (array) => array()
Arguments array

Usage

  1. if ( !function_exists( 'cmb2_metabox_form' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'cmb2/includes/helper-functions.php'; 
  3.  
  4. // Metabox config array or Metabox ID 
  5. $meta_box = null; 
  6.  
  7. // The object id. 
  8. $object_id = -1; 
  9.  
  10. // Optional arguments array 
  11. $args = array(); 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = cmb2_metabox_form($meta_box, $object_id, $args); 
  15.  

Defined (1)

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

/includes/helper-functions.php  
  1. function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) { 
  2. if ( ! isset( $args['echo'] ) || $args['echo'] ) { 
  3. cmb2_print_metabox_form( $meta_box, $object_id, $args ); 
  4. } else { 
  5. return cmb2_get_metabox_form( $meta_box, $object_id, $args );