[ Index ]

WordPress Cross Reference

title

Body

[close]

/wp-includes/ -> option.php (summary)

Option API

File Size: 1077 lines (35 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 25 functions

  get_option()
  wp_protect_special_option()
  form_option()
  wp_load_alloptions()
  wp_load_core_site_options()
  update_option()
  add_option()
  delete_option()
  delete_transient()
  get_transient()
  set_transient()
  wp_user_settings()
  get_user_setting()
  set_user_setting()
  delete_user_setting()
  get_all_user_settings()
  wp_set_all_user_settings()
  delete_all_user_settings()
  get_site_option()
  add_site_option()
  delete_site_option()
  update_site_option()
  delete_site_transient()
  get_site_transient()
  set_site_transient()

Functions
Functions that are not part of a class:

get_option( $option, $default = false )   X-Ref
Retrieve option value based on name of option.

If the option does not exist or does not have a value, then the return value
will be false. This is useful to check whether you need to install an option
and is commonly used during installation of plugin options and to test
whether upgrading is required.

If the option was serialized then it will be unserialized when it is returned.

param: string $option Name of option to retrieve. Expected to not be SQL-escaped.
param: mixed $default Optional. Default value to return if the option does not exist.
return: mixed Value set for the option.

wp_protect_special_option( $option )   X-Ref
Protect WordPress special option from being modified.

Will die if $option is in protected list. Protected options are 'alloptions'
and 'notoptions' options.

param: string $option Option name.

form_option( $option )   X-Ref
Print option value after sanitizing for forms.

param: string $option Option name.

wp_load_alloptions()   X-Ref
Loads and caches all autoloaded options, if available or all options.

return: array List of all options.

wp_load_core_site_options( $site_id = null )   X-Ref
Loads and caches certain often requested site options if is_multisite() and a persistent cache is not being used.

param: int $site_id Optional site ID for which to query the options. Defaults to the current site.

update_option( $option, $value )   X-Ref
Update the value of an option that was already added.

You do not need to serialize values. If the value needs to be serialized, then
it will be serialized before it is inserted into the database. Remember,
resources can not be serialized or added as an option.

If the option does not exist, then the option will be added with the option
value, but you will not be able to set whether it is autoloaded. If you want
to set whether an option is autoloaded, then you need to use the add_option().

param: string $option Option name. Expected to not be SQL-escaped.
param: mixed $value Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
return: bool False if value was not updated and true if value was updated.

add_option( $option, $value = '', $deprecated = '', $autoload = 'yes' )   X-Ref
Add a new option.

You do not need to serialize values. If the value needs to be serialized, then
it will be serialized before it is inserted into the database. Remember,
resources can not be serialized or added as an option.

You can create options without values and then update the values later.
Existing options will not be updated and checks are performed to ensure that you
aren't adding a protected WordPress option. Care should be taken to not name
options the same as the ones which are protected.

param: string $option Name of option to add. Expected to not be SQL-escaped.
param: mixed $value Optional. Option value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
param: mixed $deprecated Optional. Description. Not used anymore.
param: bool $autoload Optional. Default is enabled. Whether to load the option when WordPress starts up.
return: bool False if option was not added and true if option was added.

delete_option( $option )   X-Ref
Removes option by name. Prevents removal of protected WordPress options.

param: string $option Name of option to remove. Expected to not be SQL-escaped.
return: bool True, if option is successfully deleted. False on failure.

delete_transient( $transient )   X-Ref
Delete a transient.

param: string $transient Transient name. Expected to not be SQL-escaped.
return: bool true if successful, false otherwise

get_transient( $transient )   X-Ref
Get the value of a transient.

If the transient does not exist or does not have a value, then the return value
will be false.

param: string $transient Transient name. Expected to not be SQL-escaped
return: mixed Value of transient

set_transient( $transient, $value, $expiration = 0 )   X-Ref
Set/update the value of a transient.

You do not need to serialize values. If the value needs to be serialized, then
it will be serialized before it is set.

param: string $transient Transient name. Expected to not be SQL-escaped.
param: mixed $value Transient value. Must be serializable if non-scalar. Expected to not be SQL-escaped.
param: int $expiration Time until expiration in seconds, default 0
return: bool False if value was not set and true if value was set.

wp_user_settings()   X-Ref
Saves and restores user interface settings stored in a cookie.

Checks if the current user-settings cookie is updated and stores it. When no
cookie exists (different browser used), adds the last saved cookie restoring
the settings.


get_user_setting( $name, $default = false )   X-Ref
Retrieve user interface setting value based on setting name.

param: string $name The name of the setting.
param: string $default Optional default value to return when $name is not set.
return: mixed the last saved user setting or the default value/false if it doesn't exist.

set_user_setting( $name, $value )   X-Ref
Add or update user interface setting.

Both $name and $value can contain only ASCII letters, numbers and underscores.
This function has to be used before any output has started as it calls setcookie().

param: string $name The name of the setting.
param: string $value The value for the setting.
return: bool true if set successfully/false if not.

delete_user_setting( $names )   X-Ref
Delete user interface settings.

Deleting settings would reset them to the defaults.
This function has to be used before any output has started as it calls setcookie().

param: mixed $names The name or array of names of the setting to be deleted.
return: bool true if deleted successfully/false if not.

get_all_user_settings()   X-Ref
Retrieve all user interface settings.

return: array the last saved user settings or empty array.

wp_set_all_user_settings( $user_settings )   X-Ref
Private. Set all user interface settings.

param: array $user_settings
return: bool

delete_all_user_settings()   X-Ref
Delete the user settings of the current user.


get_site_option( $option, $default = false, $use_cache = true )   X-Ref
Retrieve site option value based on name of option.

param: string $option Name of option to retrieve. Expected to not be SQL-escaped.
param: mixed $default Optional value to return if option doesn't exist. Default false.
param: bool $use_cache Whether to use cache. Multisite only. Default true.
return: mixed Value set for the option.

add_site_option( $option, $value )   X-Ref
Add a new site option.

Existing options will not be updated. Note that prior to 3.3 this wasn't the case.

param: string $option Name of option to add. Expected to not be SQL-escaped.
param: mixed $value Optional. Option value, can be anything. Expected to not be SQL-escaped.
return: bool False if option was not added and true if option was added.

delete_site_option( $option )   X-Ref
Removes site option by name.

param: string $option Name of option to remove. Expected to not be SQL-escaped.
return: bool True, if succeed. False, if failure.

update_site_option( $option, $value )   X-Ref
Update the value of a site option that was already added.

param: string $option Name of option. Expected to not be SQL-escaped.
param: mixed $value Option value. Expected to not be SQL-escaped.
return: bool False if value was not updated and true if value was updated.

delete_site_transient( $transient )   X-Ref
Delete a site transient.

param: string $transient Transient name. Expected to not be SQL-escaped.
return: bool True if successful, false otherwise

get_site_transient( $transient )   X-Ref
Get the value of a site transient.

If the transient does not exist or does not have a value, then the return value
will be false.

param: string $transient Transient name. Expected to not be SQL-escaped.
return: mixed Value of transient

set_site_transient( $transient, $value, $expiration = 0 )   X-Ref
Set/update the value of a site transient.

You do not need to serialize values, if the value needs to be serialize, then
it will be serialized before it is set.

param: string $transient Transient name. Expected to not be SQL-escaped.
param: mixed $value Transient value. Expected to not be SQL-escaped.
param: int $expiration Time until expiration in seconds, default 0
return: bool False if value was not set and true if value was set.



Generated: Tue Mar 25 01:41:18 2014 WordPress honlapkészítés: online1.hu