Tutorial by Examples

get_option function is used to retrieve a value from from options table based on option name. You can use the following code to get email address of a WordPress site administrator. <?php echo get_option('admin_email'); ?> get_option() has an optional 2nd argument, which allows you to set ...
add_option function ins used to insert new row into options table. This will insert a new row in options table with option name some_option_name and value as some_option_value <?php add_option( 'some_option_name', 'some_option_value' ); ?>
delete_option function is used to delete an option from the options table. This will delete my_custom_option from the options table. <?php delete_option( 'my_custom_option' ); ?>
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' );

Page 1 of 1