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

Function Reference/get option


A safe way of getting values for a named option from the options database table. If the desired option does not exist, or no value is associated with it, FALSE will be returned.


 <?php echo get_option$option$default ); ?> 


(string) (required) Name of the option to retrieve. Underscores separate words, lowercase only.
Default: None

A concise list of valid options is below, but a more complete one can be found at the Option Reference.

  • 'admin_email' - E-mail address of blog administrator.
  • 'blogname' - Weblog title; set in General Options.
  • 'blogdescription' - Tagline for your blog; set in General Options.
  • 'blog_charset' - Character encoding for your blog; set in Reading Options.
  • 'date_format' - Default date format; set in General Options.
  • 'default_category' - Default post category; set in Writing Options.
  • 'home' - The blog's home web address; set in General Options.
  • 'siteurl' - WordPress web address; set in General Options.
    Warning: This is not the same as get_bloginfo('siteurl') (which will return the homepage url), but as get_bloginfo('wpurl').
  • 'template' - The current theme's name; set in Presentation.
  • 'start_of_week' - Day of week calendar should start on; set in General Options.
  • 'upload_path' - Default upload location; set in Miscellaneous Options.
  • 'users_can_register' - Whether users can register; set in General Options.
  • 'posts_per_page' - Maximum number of posts to show on a page; set in Reading Options.
  • 'posts_per_rss' - Maximum number of most recent posts to show in the syndication feed; set in Reading Options.
There are many more options available, a lot of which depend on what plugins you have installed.
(mixed) (optional) The default value to return if no value is returned (ie. the option is not in the database).
Default: false

Return Values

Current value for the specified option. If the option does not exist, returns parameter $default if specified or boolean FALSE by default.



get_option'no_exists_value' );
var_dump$no_exists_value ); /* outputs false */

$no_exists_value get_option'no_exists_value''default_value' );
var_dump$no_exists_value ); /* outputs 'default_value' */


Show Blog Title

Displays your blog's title in a <h1> tag.  <h1><?php echo get_option'blogname' ); ?></h1> 

Show Character Set

Displays the character set your blog is using (ex: UTF-8)  <p>Character set: <?php echo get_option'blog_charset' ); ?> </p> 

Retrieve Administrator E-mail

Retrieve the e-mail of the blog administrator, storing it in a variable.  <?php $admin_email get_option'admin_email' ); ?> 


  • Uses: apply_filters()
    • Calls 'pre_option_$option' before checking the option. Any value other than false will "short-circuit" the retrieval of the option and return the returned value. You should not try to override special options, but you will not be prevented from doing so.
    • Calls 'option_$option', after checking the option, with the option value.
    • Calls 'default_option_$option' to filter $default before returning it if it is set and the value doesn't exist.
  • Uses: maybe_unserialize() to unserialize the value before returning it.


  • Since 1.5.0

Source File

get_option() is located in wp-includes/option.php.


See also index of Function Reference and index of Template Tags.