WordPress bloginfo() Function

Beginner
4 min read
Updated: Nov 2026
3 examples
Template tag

Definition

In WordPress, bloginfo() prints a piece of information about your site, such as the site title, the tagline, or the home URL.

Tell it what you want with the $show value. Common values are name, description, url, charset, version, and language. If you need the value in a variable instead, use get_bloginfo().

Syntax

Call it with one value. The text is printed right away.

WordPress
<?php bloginfo( 'name' ); ?>
CallWhat it does
bloginfo( 'name' )Prints the site title.
bloginfo( 'description' )Prints the tagline.
bloginfo( 'url' )Prints the home URL.

Need the text in a variable? Use get_bloginfo() instead.

Full declaration
WordPress
bloginfo( string $show = '' ): void

Parameters

ParameterDescription
$showstring. What to print, for example name, description, url, wpurl, charset, version, language, stylesheet_url. Default is an empty string, which prints the site title.

Return Value

Return ValueDescription
voidNothing is returned. The value is printed.

WordPress Examples

Three short theme examples. Each one shows the code and what it prints.

Example 1 — Print the site name and tagline

Show both in the header.

WordPress
<h1><?php bloginfo( 'name' ); ?></h1>
<p><?php bloginfo( 'description' ); ?></p>

How It Works

  1. name is the Site Title from Settings > General.
  2. description is the Tagline.
  3. Both values are printed straight into the HTML.

Example 2 — Meta charset and language

Use bloginfo() in the head of the page.

WordPress
<html lang="<?php bloginfo( 'language' ); ?>">
<head>
  <meta charset="<?php bloginfo( 'charset' ); ?>">

How It Works

  1. language prints the site language code.
  2. charset prints the character set, usually UTF-8.
  3. This keeps the markup in sync with your Settings.

Frequently Asked Questions

It prints one piece of site information, such as the name, tagline, URL, or charset.
bloginfo() prints the value. get_bloginfo() returns it so you can store it in a variable or use it in a string.
It prints the site title, the same as bloginfo( 'name' ).
They give the same address in most sites. home_url() is the modern helper and also lets you add a path.

Next: calendar_week_mod()

Get the day of the week as a number from 0 to 6 (a modulo 7 helper).

calendar_week_mod() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

7 people found this page helpful