cmb2_get_field_value

Get a field's value.

Description

cmb2_get_field_value( (array) $meta_box, (array) $field_id, (int) $object_id = 0, (string) $object_type = '' ); 

Parameters (4)

0. $meta_box (array)
Metabox ID or Metabox config array
1. $field_id (array)
Field ID or all field arguments
2. $object_id — Optional. (int)
The object id.
3. $object_type — Optional. (string) => ''
Type of object being saved. (e.g., post, user, comment, or options-page). Defaults to metabox object type.

Usage

  1. if ( !function_exists( 'cmb2_get_field_value' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/includes/libraries/metabox/includes/helper-functions.php'; 
  3.  
  4. // Metabox ID or Metabox config array 
  5. $meta_box = array(); 
  6.  
  7. // Field ID or all field arguments 
  8. $field_id = array(); 
  9.  
  10. // The object id. 
  11. $object_id = -1; 
  12.  
  13. // Type of object being saved. (e.g., post, user, comment, or options-page). 
  14. // Defaults to metabox object type. 
  15. $object_type = ''; 
  16.  
  17. // NOTICE! Understand what this does before running. 
  18. $result = cmb2_get_field_value($meta_box, $field_id, $object_id, $object_type); 
  19.  

Defined (2)

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

/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_field_value( $meta_box, $field_id, $object_id = 0, $object_type = '' ) { 
  2. $field = cmb2_get_field( $meta_box, $field_id, $object_id, $object_type ); 
  3. return $field->escaped_value(); 
/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_field_value( $meta_box, $field_id, $object_id = 0, $object_type = '' ) { 
  2. $field = cmb2_get_field( $meta_box, $field_id, $object_id, $object_type ); 
  3. return $field->escaped_value();