Using WordPress ‘get_bloginfo()’ PHP function

The get_bloginfo() WordPress PHP function retrieves information about the current site.

Usage

get_bloginfo( $show, $filter )

Example:

$site_name = get_bloginfo('name');

Output: The site name

Parameters

  • $show (string) Optional: Site info to retrieve. Default: empty (site name)
  • $filter (string) Optional: How to filter what is retrieved. Default: ‘raw’

More information

See WordPress Developer Resources: get_bloginfo

Examples

Get site title

Get the site title and store it in a variable:

$site_title = get_bloginfo('name');

Get site description

Get the site description (tagline) and display it:

echo 'Your Blog Tagline is: ' . get_bloginfo('description');

Get WordPress address (URL)

Get the WordPress address (URL) and store it in a variable:

$wp_address = get_bloginfo('wpurl');

Get site address (URL)

Get the site address (URL) and store it in a variable:

$site_url = get_bloginfo('url');

Get admin email

Get the admin email and store it in a variable:

$admin_email = get_bloginfo('admin_email');