You appear to be a bot. Output may be restricted
Description
Update an option
Updates an edd setting value in both the db and the global variable. Warning: Passing in an empty, false or null string value will remove
- the key from the edd_options array.
Usage
$boolean = edd_update_option( $key, $value );
Parameters
- $key
- ( string ) optional – The Key to update
- $value
- ( string|bool|int ) optional – The value to set the key to
Returns
boolean True if updated, false if not.
Source
File name: easy-digital-downloads/includes/admin/settings/register-settings.php
Lines:
1 to 31 of 31
function edd_update_option( $key = '', $value = false ) { // If no key, exit if ( empty( $key ) ){ return false; } if ( empty( $value ) ) { $remove_option = edd_delete_option( $key ); return $remove_option; } // First let's grab the current settings $options = get_option( 'edd_settings' ); // Let's let devs alter that value coming in $value = apply_filters( 'edd_update_option', $value, $key ); // Next let's try to update the value $options[ $key ] = $value; $did_update = update_option( 'edd_settings', $options ); // If it updated, let's update the global variable if ( $did_update ){ global $edd_options; $edd_options[ $key ] = $value; } return $did_update; }