Ready to get started?Download WordPress


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

Difference between revisions of "Function Reference/get option"

m (Changed wording)
(Using Parameter template)
Line 38: Line 38:
== Parameters ==
== Parameters ==
{{Parameter|$show|string|Name of the option to retrieve. A list of valid default options can be found at the [[Option Reference]].}}
; show : (''string'') Name of the option. Underscores separate words, lowercase only - this is going to be in a database. A list of valid default options can be found at the [[Option Reference]].
== Related ==
== Related ==

Revision as of 02:10, 13 January 2008


A safe way of getting values for a named option from the options database table.


For a complete list of all options available through this function, go to


Also: You can modify any/all of the options from the same page.


 <?php echo get_option('show'); ?> 


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'); ?> 


(string) (required) Name of the option to retrieve. A list of valid default options can be found at the Option Reference.
Default: None



Code Documentation

  • Class: WP_Query - Detailed Overview of class WP_Query
  • Class: WP_Comment_Query - Class for comment-related queries
  • Class: WP_User_Query - Class for user-related queries
  • Object: $wpdb - Overview on the use of the $wpdb object
  • Function: get_query_var()
  • Function: query_posts() - Create additional custom query
  • Function: get_post() - Take an ID of an item and return the records in the database for that article
  • Function: get_posts() - A specialized function that returns an array of items
  • Function: get_pages() - A specialized function that returns an array of pages
  • Function: have posts() - a condition that determines whether the query returned an article
  • Function: the_post() - Used to automatically set the loop after a query
  • Function: rewind_posts() - Clears the current loop
  • Function: setup_postdata() - Sets the data for a single query result within a loop
  • Function: wp_reset_postdata() - Restores the previous query (usually after a loop within another loop)
  • Function: wp_reset_query()
  • Function: is_main_query() - Ensures that the query that is being changed is only the main query
  • Action Hook: pre_get_posts - Change WordPress queries before they are executed
  • Action Hook: the_post - Modify the post object after query
  • Filter Hook: found_posts - Changes the value of the object found_posts WP_Query
See also index of Function Reference and index of Template Tags.