Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808
PUM_Utils_Options::delete( string|array $keys = '' )

Remove an option or multiple


Description Description

Removes a setting value in both the db and the global variable.


Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Warning: foreach() argument must be of type array|object, string given in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 813

Warning: Array to string conversion in /mnt/data/home/502433.cloudwaysapps.com/rhbymdevka/public_html/wp-content/themes/wporg-developer/inc/template-tags.php on line 808

Parameters Parameters

$keys

(Optional) The Key/s to delete

Default value: ''


Top ↑

Return Return

(boolean) True if updated, false if not.


Top ↑

Source Source

File: classes/Utils/Options.php

	public static function delete( $keys = '' ) {
		// Passive initialization.
		self::init();

		// If no key, exit
		if ( empty( $keys ) ) {
			return false;
		} else if ( is_string( $keys ) ) {
			$keys = array( $keys );
		}

		// First let's grab the current settings
		$options = get_option( self::$_prefix . 'settings' );

		// Remove each key/value pair.
		foreach ( $keys as $key ) {
			if ( isset( $options[ $key ] ) ) {
				unset( $options[ $key ] );
			}
		}

		$did_update = update_option( self::$_prefix . 'settings', $options );

		// If it updated, let's update the global variable
		if ( $did_update ) {
			self::$_data = $options;
		}

		return $did_update;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.