There are some functions associated with manipulating the variables found in the wp_options
table.
add_option(): Create a new value in the table. Example add_option('var_name', 'value')
will store option_name="var_name"
and option_value="value"
. add_option()
is used only when saving a value for the first time. Has an autoload
parameter.
get_option(): Retrieve that value. Example: get_option('var_name')
will return the string value
.
update_option(). Will update the value of an option. Can also be used instead of add_option()
, but it lacks the autoload
parameter.
As for serializing data, WordPress will do it automatically if you use the above options with an array.
Related Posts:
- Upgrade 4.5.2 to 4.5.3 deleting row in wp_options table
- ‘Global’ settings page for multisite plugin
- How to add field for new site-wide option on Network Settings screen?
- Contact form 7 select box different value-text than content-text in option [closed]
- Modifying a JS file with data from plugin settings
- Correct way to serialize the data of options table?
- Where should I use get_option in a plugin
- Inherit plugin settings to new site in Multisite
- How to tell if plugin has been network activated
- Is there a hook attached to general settings save?
- How to find out if option exists but is empty?
- How should I use register_setting, add_settings_section, & add_settings_field in my plugin’s options page?
- Custom plugin settings: clicking “save changes” does not display success message
- Duplicate settings of master blog to slave blogs in WP multi-site installation
- Environment Specific Options Token
- How do I extract the Alt Text from an image attachment upload via the WordPress Options Framework Plugin?
- Network-Wide Plugin Settings Management
- How to create a Page alias in WordPress
- How to fetch serialized data from wordpress options
- Add custom meta box on Post page
- Some Plugin Settings Are Kept After Removal and Reinstall of the Plugin
- Changing widget options via the functions.php when there are no hooks
- While Using Static Pages, How Can I Get /blog into the URL of Each Post?
- Get all options saved by another plugin
- Is it ok to call get_option without hooks?
- Enable/Disable WP options programmatically
- Custom options page checkbox will not save, despite working with text
- Settings API – input always updates over validation
- add function to saving change on Options Pages
- WooCommerce “Save Changes” button appears inside custom settings
- clean wp_options table unused rows
- How to set CORS header?
- Prepare plugin options for multi-lingual support
- Is there a reliable way to keep track of how long a WordPress theme has been active?
- Remove obsolete plugins artifacts from database tables
- Restore a Plugin’s Default Settings
- add action wp_head not working
- How to debug register_setting callback function
- Why is the Settings API is not saving my array of options
- Creating a plugin that will add options. Where should the options menu pages go?
- Add get_option to jquery
- update_user_meta add value on the top on existing value
- Can’t get plugin settings page to save data
- Default Plugin Settings Not Writing to Database
- Update Option Error: Notice: Undefined index
- How do i save plugin-specific info?
- Set the active Navigation Menu from a plugin
- Serialize data for wp options
- How can I add an options page for my class based plugin?
- problems with wordpress and php version 5.3.3-1
- Why slash is removed after domain?
- Where does WordPress store plugin (enabled/disabled) status for multisite?
- How to add a default value to get_option if it’s used as a variable?
- WordPress get_option and update_option returned entered on the textbox field
- Get plugin option in another PHP file
- Create mobile navigation header with settings integration
- Image upload and other options in the same plugin settings form?
- Admin Theme customization
- How to get specific setting by settings_fields()?
- Add Plugin options as subpage to Theme options page
- changes to widget settings not showing up in individual pages pages until they’re updated [closed]
- Show admin notice on incorrect value on form field
- How to remove traces from widget during uninstallation
- php page not found for plugin options menu
- add tabs in rdp-plugin/includes/settings.php and get settings saved
- Enabling plugin failed because MySQL user do not have CREATE permissions
- wp_editor content in plugin options page
- How to create an option page for this simple plugin
- Redirect to another page using contact form 7? [closed]
- get_option error plugin development
- Gathering and logging data from a plugin: how to do it without race conditions?
- Update a core option from plugin settings page
- WordPress error: Options page Setting_ not found in the allowed options list
- Can I use register_settings and unregister_setting once the settings page has loaded?
- update_option_{$option} not showing old value
- Updating options into the wp database performance
- Can deactivating a plugin sometimes “reset” settings within that plugin?
- Allowed memory size exhausted problem
- Change the style of h1, h2, only in post entry
- Plugin getting Cannot modify header information errors
- How to add options to the plugin page?
- Saving widget options from class method
- How to prevent plugins from sniffing/stealing other plugins’ options?
- Default plugin config to override wp_options?
- get_option / wp_localize_script Not Working in OOP Plug In
- OceanWP settings are missing from Add New Post [closed]
- Change in one place the data about the company, which are placed on several pages
- Plugin scheduled event not working
- Update WP option by plugin
- How to save plugin custom settings page fields
- How to reinstate previously saved option?
- How (or where) do I get wordpress plugin update download link?
- How to access values from your own settings page in javascript?
- Neither update_option nor delete_option fires in deactivation hook
- wp_options Table keeps growing
- move setting data from wordpress api to codestar freamwork
- Multiple plugins settings of same developer into ONE settings page linked together
- When to store store plugin options as a single database record?
- How to fix a Wordfence scan that doesn’t finish?
- Secure way to add JS Script to WordPress filesystem