Codex

Function Reference/get bloginfo

Contents

Description

The get_bloginfo() function returns information about your blog which can then be used elsewhere in your PHP code. This function, as well as bloginfo(), can also be used to display your blog information.

Usage

 <?php get_bloginfo$show ); ?> 

Parameters

$show
(string) (Optional) Keyword naming the information you want.
Default: name

If you omit this parameter or pass any value besides those below, the function returns the Weblog title.

name
(default) returns the Weblog title set in AdministrationSettingsGeneral. This data is retrieved from the blogname record in the wp_options table.
description
the Tagline set in AdministrationSettingsGeneral. This data is retrieved from the blogdescription record in the wp_options table.
url
home (deprecated)
siteurl (deprecated)
the Blog address (URI) is the URL for your blog's web site address and is set in AdministrationSettingsGeneral. This data is retrieved from the home record in the wp_options table.
wpurl
the WordPress address (URI) is the URL for your WordPress installation and is set in AdministrationSettingsGeneral. This data is retrieved from the siteurl record in the wp_options table.
rdf_url
URL for the blog's RDF/RSS 1.0 feed (/feed/rfd).
rss_url
URL for the blog's RSS 0.92 feed (/feed/rss).
rss2_url
URL for the blog's RSS 2.0 feed (/feed).
atom_url
URL for the blog's Atom feed (/feed/atom).
comments_rss2_url
URL for the blog's comments RSS 2.0 feed (/comments/feed).
pingback_url
URL for Pingback XML-RPC file (xmlrpc.php).
stylesheet_url
URL for primary CSS file (usually style.css) of the active theme.
stylesheet_directory
URL of the stylesheet directory of the active theme. (Was a local path in earlier WordPress versions.)
template_directory
template_url
URL of the active theme's directory. (template_directory was a local path before 2.6; see get_theme_root() and get_template() for hackish alternatives.)
admin_email
The Administrator's E-mail address set in AdministrationSettingsGeneral. This data is retrieved from the admin_email record in the wp_options table.
charset
The Encoding for pages and feeds set in AdministrationSettingsReading. This data is retrieved from the blog_charset record in the wp_options table.
version
Version of WordPress your blog uses. This data is the value of $wp_version variable set in wp-includes/version.php.
html_type
Content-Type of WordPress HTML pages (default: text/html); stored in the html_type record in the wp_options table. Themes and plugins can override the default value by using the pre_option_html_type filter (see this section of the Codex for more information on pre_option_ filters).

Examples

Default Usage

The default usage assigns your blog's title to the variable $blog_title.

 <?php $blog_title = get_bloginfo(); ?>

Blog Title

This example assign your blog's title to the variable $blog_title. This returns the same result as the default usage.

 <?php $blog_title = get_bloginfo('name'); ?>

Blog Tagline

Using this example:

 <?php echo 'Your Blog Tagline is: ' . get_bloginfo ( 'description' );  ?><br />

results in this being displayed on your blog:

 Your Blog Tagline is: All things WordPress

Template Directory

Returns template directory URL to the active theme.

Example output

From version 2.7. On host example, the Blog address (URL) is shown at http://example/home, and the WordPress address (URL) is installed at http://example/home/wp.

Note that directory URLs are missing trailing slashes.

admin_email = admin@example
atom_url = http://example/home/feed/atom
charset = UTF-8
comments_atom_url = http://example/home/comments/feed/atom
comments_rss2_url = http://example/home/comments/feed
description = Just another WordPress blog
home = http://example/home
html_type = text/html
language = en-US
name = Testpilot
pingback_url = http://example/home/wp/xmlrpc.php
rdf_url = http://example/home/feed/rdf
rss2_url = http://example/home/feed
rss_url = http://example/home/feed/rss
siteurl = http://example/home
stylesheet_directory = http://example/home/wp/wp-content/themes/largo
stylesheet_url = http://example/home/wp/wp-content/themes/largo/style.css
template_directory = http://example/home/wp/wp-content/themes/largo
template_url = http://example/home/wp/wp-content/themes/largo
text_direction = ltr
url = http://example/home
version = 2.7
wpurl = http://example/home/wp

Related

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