wp-includes/general-template.php:1018Retrieve site info with get_bloginfo(): the site title, tagline, URL, WordPress version, language, charset, or feed URLs, selected by the $show argument. With no argument it returns the site name; pass 'display' as the second argument when echoing so the bloginfo filters run.
Retrieves information about the current site.
$showstringoptional''$filterstringoptional'raw'stringEvery example is editable and runs in a real WordPress booted in your browser by WordPress Playground. Press Run, then edit the code: clicking away re-runs it. Nothing is sent anywhere until you do.
Fetch the title and tagline with the 'display' filter when the values are going straight into markup.
$site_name = get_bloginfo( 'name', 'display' );
$tagline = get_bloginfo( 'description', 'display' );
printf(
'<a class="site-brand" href="%s">%s</a> <span class="tagline">%s</span>',
esc_url( home_url( '/' ) ),
esc_html( $site_name ),
esc_html( $tagline )
);'siteurl' and 'home' are deprecated $show values and trigger _deprecated_argument(); use 'url' for the site address and 'wpurl' for the WordPress install address, which differ when core lives in a subdirectory.
2 hooks fire while get_bloginfo() runs, in this order:
Filters the URL returned by get_bloginfo().
Filters the site information returned by get_bloginfo().
function get_bloginfo( $show = '', $filter = 'raw' ) { switch ( $show ) { case 'home': // Deprecated. case 'siteurl': // Deprecated. _deprecated_argument( __FUNCTION__, '2.2.0', sprintf( /* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument. */ __( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ), '<code>' . $show . '</code>', '<code>bloginfo()</code>', '<code>url</code>' ) ); // Intentional fall-through to be handled by the 'url' case. case 'url': $output = home_url(); break; case 'wpurl': $output = site_url(); break; case 'description': $output = get_option( 'blogdescription' ); break; case 'rdf_url': $output = get_feed_link( 'rdf' ); break; case 'rss_url': $output = get_feed_link( 'rss' ); break; case 'rss2_url': $output = get_feed_link( 'rss2' ); break; case 'atom_url': $output = get_feed_link( 'atom' ); break; case 'comments_atom_url': $output = get_feed_link( 'comments_atom' ); break; case 'comments_rss2_url': $output = get_feed_link( 'comments_rss2' ); break; case 'pingback_url': $output = site_url( 'xmlrpc.php' ); break; case 'stylesheet_url': $output = get_stylesheet_uri(); break; case 'stylesheet_directory': $output = get_stylesheet_directory_uri(); break; case 'template_directory': case 'template_url': $output = get_template_directory_uri(); break; case 'admin_email': $output = get_option( 'admin_email' ); break; case 'charset': $output = get_option( 'blog_charset' ); if ( '' === $output ) { $output = 'UTF-8'; } break; case 'html_type': $output = get_option( 'html_type' ); break; case 'version': global $wp_version; $output = $wp_version; break; case 'language': /* * translators: Translate this to the correct language tag for your locale, * see https://www.w3.org/International/articles/language-tags/ for reference. * Do not translate into your own language. */ $output = __( 'html_lang_attribute' ); if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {Introduced in 0.71. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/general-template.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.