Options API

跳转至: 导航搜索


The Options API is a simple and standardized way of storing data in the database. The API makes it easy to create, access, update, and delete those options. All the data is being stored in the wp_options table under a given custom name. This page contains the technical documentation use the Options API. A list of default options can be found in the Option Reference.

Note that the 'site_' functions are essentially the same as their counterparts, but work network wide when using WP Multisite.

Function Reference

Add/Delete Option
Get/Update Option


// Create an option to the database
add_option( $option, $value = , $deprecated = , $autoload = 'yes' );

// Removes option by name.
delete_option( $option );

// Fetch a saved option
get_option( $option, $default = false );

// Update the value of an option that was already added.
update_option( $option, $newvalue );