Options_API
Options API Class.
Namespace: WebberZone\Knowledge_Base
Since: 3.0.0
Source: includes/class-options-api.php line 21
Methods
get_settings() static
Get Settings.
Retrieves all plugin settings
Since: 3.0.0
Line: 55
static public function get_settings( ): array;
Returns: array — Settings array
get_option() static
Get an option
Looks to see if the specified setting exists, returns default if not
Since: 3.0.0
Line: 80
static public function get_option( $key = ..., $default_value = ... ): mixed;
| Type | Name | Description |
|---|---|---|
string | $key | Option to fetch. |
mixed | $default_value | Default option. |
Returns: mixed
update_option() static
Update an option
Updates a 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 settings array.
Since: 3.0.0
Line: 130
static public function update_option( $key = ..., $value = ... ): boolean;
| Type | Name | Description |
|---|---|---|
string | $key | The Key to update. |
string|bool|int | $value | The value to set the key to. |
Returns: boolean — True if updated, false if not.
update_settings() static
Update all settings at once.
Since: 3.0.0
Line: 164
static public function update_settings( array $settings, bool $merge = ..., bool $autoload = ... ): bool;
| Type | Name | Description |
|---|---|---|
array | $settings | Settings array to save. |
bool | $merge | Whether to merge with existing settings. Default true. |
bool | $autoload | Whether to autoload the option. Default true. |
Returns: bool — True if updated, false otherwise.
delete_option() static
Remove an option
Removes a setting value in both the db and the static variable.
Since: 3.0.0
Line: 187
static public function delete_option( $key = ... ): boolean;
| Type | Name | Description |
|---|---|---|
string | $key | The Key to delete. |
Returns: boolean — True if updated, false if not.
get_settings_defaults() static
Default settings.
Since: 3.0.0
Line: 218
static public function get_settings_defaults( ): array;
Returns: array — Default settings
get_default_option() static
Get the default option for a specific key
Since: 3.0.0
Line: 230
static public function get_default_option( $key = ... ): mixed;
| Type | Name | Description |
|---|---|---|
string | $key | Key of the option to fetch. |
Returns: mixed
reset_settings() static
Reset settings.
Since: 3.0.0
Line: 247
static public function reset_settings( ): bool;
Returns: bool — True if updated, false if not.