Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/update option


A safe way of updating or adding a named option/value pair to the options database table. The indata is escaped with $wpdb->escape before the INSERT statement.

This function can be called even if the option does not exist, the function will create the option.

See add_option for more information.


<?php update_option($name, $value = '', $description = '', $autoload = 'yes'); ?>



<?php update_option("myhack_extraction_length", '255', 
'Max length of extracted text in characters.', 'yes'); ?>


(string) (required) Name of the option to update. A list of valid default options to update can be found at the Option Reference.
Default: None
(string) (optional) Value for this option name. You can find possible values for the default options at the Option Reference.
Default: Empty
(string) (optional) Descriptive text for the option. The description can be used in backend labels.
Default: Empty
(string) (optional) Should this option be automatically loaded? Valid values: yes or no.
Default: yes
This article is marked as in need of editing. You can help Codex by editing it.