monsterinsights_get_option

Helper method for getting a setting's value.

Description

(string) monsterinsights_get_option( (string) $key = '', (bool) $default = false ); 

Falls back to the default setting value if none exists in the options table.

Returns (string)

The value of the setting.

Parameters (2)

0. $key — Optional. (string) => ''
The setting key to retrieve.
1. $default — Optional. (bool) => false
The default value of the setting key to retrieve.

Usage

  1. if ( !function_exists( 'monsterinsights_get_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/options.php'; 
  3.  
  4. // The setting key to retrieve. 
  5. $key = ''; 
  6.  
  7. // The default value of the setting key to retrieve. 
  8. $default = false; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = monsterinsights_get_option($key, $default); 
  12.  

Defined (1)

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

/includes/options.php  
  1. function monsterinsights_get_option( $key = '', $default = false ) { 
  2. global $monsterinsights_settings; 
  3. $value = ! empty( $monsterinsights_settings[ $key ] ) ? $monsterinsights_settings[ $key ] : $default; 
  4. $value = apply_filters( 'monsterinsights_get_option', $value, $key, $default ); 
  5. return apply_filters( 'monsterinsights_get_option_' . $key, $value, $key, $default );