WordPress Options API update_option


Example

update_option function is used to update a value that already exists in the options table. If the option does not exist, then the option will be added with the option value.

This will set the default comment status to 'closed':

update_option( 'default_comment_status', 'closed' );