get_bloginfo() – Retrieves information about the current site.

You appear to be a bot. Output may be restricted

Description

Retrieves information about the current site.

Possible values for $show include:

  • 'name' – Site title (set in Settings > General)
  • 'description' – Site tagline (set in Settings > General)
  • 'wpurl' – The WordPress address (URL) (set in Settings > General)
  • 'url' – The Site address (URL) (set in Settings > General)
  • 'admin_email' – Admin email (set in Settings > General)
  • 'charset' – The "Encoding for pages and feeds" (set in Settings > Reading)
  • 'version' – The current WordPress version
  • 'html_type' – The content-type (default: "text/html"). Themes and plugins
  • can override the default value using the pre_option_html_type filter
  • 'text_direction' – The text direction determined by the site's language. is_rtl()
  • should be used instead
  • 'language' – Language code for the current site
  • 'stylesheet_url' – URL to the stylesheet for the active theme. An active child theme
  • will take precedence over this value
  • 'stylesheet_directory' – Directory path for the active theme. An active child theme
  • will take precedence over this value
  • 'template_url' / 'template_directory' – URL of the active theme's directory. An active
  • child theme will NOT take precedence over this value
  • 'pingback_url' – The pingback XML-RPC file URL (xmlrpc.php)
  • 'atom_url' – The Atom feed URL (/feed/atom)
  • 'rdf_url' – The RDF/RSS 1.0 feed URL (/feed/rdf)
  • 'rss_url' – The RSS 0.92 feed URL (/feed/rss)
  • 'rss2_url' – The RSS 2.0 feed URL (/feed)
  • 'comments_atom_url' – The comments Atom feed URL (/comments/feed)
  • 'comments_rss2_url' – The comments RSS 2.0 feed URL (/comments/feed)

Some $show values are deprecated and will be removed in future versions. These options will trigger the _deprecated_argument() function. Deprecated arguments include:

  • 'siteurl' – Use 'url' instead
  • 'home' – Use 'url' instead

Usage

$string = get_bloginfo( $show, $filter );

Parameters

$show
( string ) optional – Optional. Site info to retrieve. Default empty (site name).
$filter
( string ) optional default: raw – Optional. How to filter what is retrieved. Default 'raw'.

Returns

string Mostly string values, might be empty.

Source

File name: wordpress/wp-includes/general-template.php
Lines:

101 to 141 of 141
      }
      break;
    case 'name':
    default:
      $output = get_option( 'blogname' );
      break;
  }

  $url = true;
  if ( strpos( $show, 'url' ) === false &&
    strpos( $show, 'directory' ) === false &&
    strpos( $show, 'home' ) === false ) {
    $url = false;
  }

  if ( 'display' === $filter ) {
    if ( $url ) {
      
/**
 * Filters the URL returned by get_bloginfo().
 *
 * @since 2.0.5
 *
 * @param string $output The URL returned by bloginfo().
 * @param string $show   Type of information requested.
 */
      $output = apply_filters( 'bloginfo_url', $output, $show );
    } else {
      
/**
 * Filters the site information returned by get_bloginfo().
 *
 * @since 0.71
 *
 * @param mixed  $output The requested non-URL site information.
 * @param string $show   Type of information requested.
 */
      $output = apply_filters( 'bloginfo', $output, $show );
    }
  }

  return $output;
}
 

 View on GitHub View on Trac