cmb2_get_option

A helper function to get an option from a CMB2 options array.

Description

(array) cmb2_get_option( (string) $option_key, (string) $field_id = '', (bool) $default = false ); 

Returns (array)

Options array or specific field

Parameters (3)

0. $option_key (string)
The option key.
1. $field_id — Optional. (string) => ''
Option array field key
2. $default — Optional. (bool) => false
Default fallback value

Usage

  1. if ( !function_exists( 'cmb2_get_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/helper-functions.php'; 
  3.  
  4. // The option key. 
  5. $option_key = ''; 
  6.  
  7. // Option array field key 
  8. $field_id = ''; 
  9.  
  10. // Optional default fallback value 
  11. $default = false; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = cmb2_get_option($option_key, $field_id, $default); 
  15.  

Defined (2)

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

/vendor/wordimpress/maps-builder-core/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_option( $option_key, $field_id = '', $default = false ) { 
  2. returncmb2_options $option_key )->get( $field_id, $default ); 
/includes/libraries/metabox/includes/helper-functions.php  
  1. function cmb2_get_option( $option_key, $field_id = '' ) { 
  2. returncmb2_options $option_key )->get( $field_id );