gmb_delete_option

Remove an option.

Description

(boolean) gmb_delete_option( (string) $key = '' ); 

Removes a setting value in the serialized settings option

Returns (boolean)

True if updated, false if not.

Parameters (1)

0. $key — Optional. (string) => ''
The Key to delete

Usage

  1. if ( !function_exists( 'gmb_delete_option' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'maps-builder/vendor/wordimpress/maps-builder-core/includes/admin/class-gmc-settings.php'; 
  3.  
  4. // The Key to delete 
  5. $key = ''; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = gmb_delete_option($key); 
  9.  

Defined (1)

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

/vendor/wordimpress/maps-builder-core/includes/admin/class-gmc-settings.php  
  1. function gmb_delete_option( $key = '' ) { 
  2.  
  3. // If no key, exit 
  4. if ( empty( $key ) ) { 
  5. return false; 
  6.  
  7. // First let's grab the current settings 
  8. $options = get_option( 'gmb_settings' ); 
  9.  
  10. // Next let's try to update the value 
  11. if ( isset( $options[ $key ] ) ) { 
  12. unset( $options[ $key ] ); 
  13. if ( isset( $_POST[ $key ] ) ) { 
  14. unset( $_POST[ $key ] ); 
  15.  
  16. $did_update = update_option( 'gmb_settings', $options ); 
  17.  
  18. return $did_update;