• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Easy Digital Downloads a2z

Easy Digital Downloads a2z

Easy Digital Downloads a2z

  • Home
  • Plugins
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / edd_update_option() – Update an option

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;
}
 

 View on GitHub View on Trac

Published: 26th November 2019 | Last updated: 8th April 2020

Primary Sidebar

Information

Function name: edd_update_option
Plugin ref: Easy Digital Downloads
Version: 2.11.6
Sourcefile: includes/admin/settings/register-settings.php
File ref: includes/admin/settings/register-settings.php
Deprecated?: No
API Letters: E,O,U

Footer

Easy Digital Downloads a2z
Easy Digital Downloads a2z
Easy Digital Downloads a2z
WordPress 5.9.3
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  edd.wp-a2z.org
© Copyright Easy Digital Downloads a2z 2014-2022. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites