WordPress get_bloginfo() Function

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

Definition

In WordPress, get_bloginfo() returns a piece of site information as a string. It takes the same $show values as bloginfo(), such as name, description, url, charset, version, and language.

Use it when you want to keep the value in a variable, join it with other text, or pass it to another function.

Syntax

Call it and store or echo the result.

WordPress
<?php
$name = get_bloginfo( 'name' );
echo $name;
CallWhat it does
get_bloginfo( 'name' )Returns the site title.
get_bloginfo( 'version' )Returns the WordPress version.
get_bloginfo( 'name', 'display' )Returns the title ready for safe display.

Want to print right away? bloginfo() is shorter.

Full declaration
WordPress
get_bloginfo( string $show = '', string $filter = 'raw' ): string

Parameters

ParameterDescription
$showstring. What to return, for example name, description, url, wpurl, charset, version, language. Default is empty (the site title).
$filterstring. raw (default) returns the value as stored. display runs display filters, such as escaping.

Return Value

Return ValueDescription
stringThe requested site information.

WordPress Examples

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

Example 1 — Echo the site name

Escape the value before printing.

WordPress
<p>&copy; <?php echo esc_html( get_bloginfo( 'name' ) ); ?></p>

How It Works

  1. get_bloginfo( 'name' ) returns the site title.
  2. esc_html() makes it safe for HTML.
  3. echo prints the final text.

Example 2 — Join with other text

Build a sentence in a variable.

WordPress
<?php
$text = 'Welcome to ' . get_bloginfo( 'name' )
      . ' - ' . get_bloginfo( 'description' );
echo esc_html( $text );

How It Works

  1. Both values are returned as strings.
  2. The dot joins the strings together.
  3. The final text is escaped and printed.

Example 3 — Show the WordPress version

Useful on a status page or in a comment.

WordPress
<?php
$version = get_bloginfo( 'version' );
echo 'Running WordPress ' . $version;

How It Works

  1. version returns the installed WordPress version.
  2. We store it in $version.
  3. Then we print a short message.

Frequently Asked Questions

It returns the requested site information as a string, such as the name, tagline, URL, or version.
get_bloginfo() returns the value. bloginfo() prints it.
raw returns the value as stored. display applies display filters such as escaping.
Common ones are name, description, url, wpurl, charset, version, language, admin_email, and stylesheet_url.

Next: get_calendar()

Print or return a small calendar table that links to days with posts.

get_calendar() 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.

11 people found this page helpful