On this page
get_bloginfo( string $show = '', string $filter = 'raw' ): string
Retrieves information about the current site.
Description
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
Parameters
$showstring Optional-
Site info to retrieve. Default empty (site name).
Default:
'' $filterstring Optional-
How to filter what is retrieved. Default
'raw'.Default:
'raw'
Return
string Mostly string values, might be empty.
More Information
Usage
$bloginfo = get_bloginfo( $show, $filter );
Source
File: wp-includes/general-template.php. View all references
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 ) ) {
$output = determine_locale();
$output = str_replace( '_', '-', $output );
}
break;
case 'text_direction':
_deprecated_argument(
__FUNCTION__,
'2.2.0',
sprintf(
/* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name. */
__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
'<code>' . $show . '</code>',
'<code>bloginfo()</code>',
'<code>is_rtl()</code>'
)
);
if ( function_exists( 'is_rtl' ) ) {
$output = is_rtl() ? 'rtl' : 'ltr';
} else {
$output = 'ltr';
}
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;
}
Hooks
- apply_filters( 'bloginfo',
mixed $output ,string $show ) -
Filters the site information returned by get_bloginfo() .
- apply_filters( 'bloginfo_url',
string $output ,string $show ) -
Filters the URL returned by get_bloginfo() .
Related
Uses
| Uses | Description |
|---|---|
| determine_locale() wp-includes/l10n.php | Determines the current locale desired for the request. |
| get_stylesheet_uri() wp-includes/theme.php | Retrieves stylesheet URI for the active theme. |
| get_stylesheet_directory_uri() wp-includes/theme.php | Retrieves stylesheet directory URI for the active theme. |
| get_template_directory_uri() wp-includes/theme.php | Retrieves template directory URI for the active theme. |
| is_rtl() wp-includes/l10n.php | Determines whether the current locale is right-to-left (RTL). |
| site_url() wp-includes/link-template.php | Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible. |
| get_feed_link() wp-includes/link-template.php | Retrieves the permalink for the feed type. |
| __() wp-includes/l10n.php | Retrieves the translation of $text. |
| _deprecated_argument() wp-includes/functions.php | Marks a function argument as deprecated and inform when it has been used. |
| home_url() wp-includes/link-template.php | Retrieves the URL for the current site where the front end is accessible. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
Used By
| Used By | Description |
|---|---|
| WP_REST_URL_Details_Controller::prepare_metadata_for_output() wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Prepares the metadata by: – stripping all HTML tags and tag entities. |
| WP_REST_URL_Details_Controller::get_remote_url() wp-includes/rest-api/endpoints/class-wp-rest-url-details-controller.php | Retrieves the document title from a remote URL. |
| WP_REST_Widget_Types_Controller::get_widgets() wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php | Normalize array of widgets. |
| core_auto_updates_settings() wp-admin/update-core.php | Display WordPress auto-updates settings. |
| Plugin_Installer_Skin::do_overwrite() wp-admin/includes/class-plugin-installer-skin.php | Check if the plugin can be overwritten and output the HTML for overwriting a plugin on upload. |
| Theme_Installer_Skin::do_overwrite() wp-admin/includes/class-theme-installer-skin.php | Check if the theme can be overwritten and output the HTML for overwriting a theme on upload. |
| WP_Recovery_Mode_Email_Service::get_debug() wp-includes/class-wp-recovery-mode-email-service.php | Return debug information in an easy to manipulate format. |
| WP_Debug_Data::debug_data() wp-admin/includes/class-wp-debug-data.php | Static function for generating site debug data when required. |
| WP_Site_Health::get_test_wordpress_version() wp-admin/includes/class-wp-site-health.php | Tests for WordPress version and outputs it. |
| validate_plugin_requirements() wp-admin/includes/plugin.php | Validates the plugin requirements for WordPress version and PHP version. |
| WP_Privacy_Policy_Content::get_default_content() wp-admin/includes/class-wp-privacy-policy-content.php | Return the default suggested privacy policy content. |
| wp_privacy_generate_personal_data_export_file() wp-admin/includes/privacy-tools.php | Generate the personal data export file. |
| WP_Widget_Text::is_legacy_instance() wp-includes/widgets/class-wp-widget-text.php | Determines whether a given instance is legacy and should bypass using TinyMCE. |
| _WP_Editors::default_settings() wp-includes/class-wp-editor.php | Returns the default TinyMCE settings. |
| WP_Customize_Nav_Menu_Item_Setting::get_original_title() wp-includes/customize/class-wp-customize-nav-menu-item-setting.php | Get original title. |
| the_embed_site_title() wp-includes/embed.php | Prints the necessary markup for the site title in an embed template. |
| get_custom_logo() wp-includes/general-template.php | Returns a custom logo, linked to home unless the theme supports removing the link on the home page. |
| WP_Customize_Site_Icon_Control::content_template() wp-includes/customize/class-wp-customize-site-icon-control.php | Renders a JS template for the content of the site icon control. |
| get_post_embed_html() wp-includes/embed.php | Retrieves the embed code for a specific post. |
| get_oembed_response_data() wp-includes/embed.php | Retrieves the oEmbed response data for a given post. |
| wp_get_document_title() wp-includes/general-template.php | Returns document title for the current page. |
| get_language_attributes() wp-includes/general-template.php | Gets the language attributes for the ‘html’ tag. |
| WP_Customize_Nav_Menus::search_available_items_query() wp-includes/class-wp-customize-nav-menus.php | Performs post queries for available-item searching. |
| WP_Customize_Nav_Menus::customize_register() wp-includes/class-wp-customize-nav-menus.php | Adds the customizer settings and controls. |
| WP_Customize_Nav_Menus::load_available_items_query() wp-includes/class-wp-customize-nav-menus.php | Performs the post_type and taxonomy queries for loading available menu items. |
| WP_Customize_Media_Control::to_json() wp-includes/customize/class-wp-customize-media-control.php | Refresh the parameters passed to the JavaScript via JSON. |
| wp_install_maybe_enable_pretty_permalinks() wp-admin/includes/upgrade.php | Maybe enable pretty permalinks on installation. |
| WP_Customize_Panel::json() wp-includes/class-wp-customize-panel.php | Gather the parameters passed to client JavaScript via JSON. |
| WP_Customize_Section::json() wp-includes/class-wp-customize-section.php | Gather the parameters passed to client JavaScript via JSON. |
| wpview_media_sandbox_styles() wp-includes/media.php | Returns the URLs for CSS files used in an iframe-sandbox’d TinyMCE media view. |
| login_footer() wp-login.php | Outputs the footer for the login page. |
| login_header() wp-login.php | Output the login page header. |
| WP_Automatic_Updater::run() wp-admin/includes/class-wp-automatic-updater.php | Kicks off the background update process, looping through all pending updates. |
| WP_Automatic_Updater::after_core_update() wp-admin/includes/class-wp-automatic-updater.php | If we tried to perform a core update, check if we should send an email, and if we need to avoid processing future updates. |
| WP_Automatic_Updater::send_email() wp-admin/includes/class-wp-automatic-updater.php | Sends an email upon the completion or failure of a background core update. |
| WP_Automatic_Updater::send_debug_email() wp-admin/includes/class-wp-automatic-updater.php | Prepares and sends an email of a full log of background update results, useful for debugging and geekery. |
| export_wp() wp-admin/includes/export.php | Generates the WXR export file for download. |
| _access_denied_splash() wp-admin/includes/ms.php | Displays an access denied message when a user tries to view a site’s dashboard they do not have access to. |
| core_update_footer() wp-admin/includes/update.php | Returns core update footer message. |
| update_right_now_message() wp-admin/includes/update.php | Displays WordPress version and active theme in the ‘At a Glance’ dashboard widget. |
| wp_welcome_panel() wp-admin/includes/dashboard.php | Displays a welcome panel to introduce users to WordPress. |
| install_plugin_information() wp-admin/includes/plugin-install.php | Displays plugin information in dialog box form. |
| WP_Plugin_Install_List_Table::display_rows() wp-admin/includes/class-wp-plugin-install-list-table.php | |
| WP_Plugin_Install_List_Table::prepare_items() wp-admin/includes/class-wp-plugin-install-list-table.php | |
| _fix_attachment_links() wp-admin/includes/post.php | Replaces hrefs of attachment anchors with up-to-date permalinks. |
| admin_created_user_email() wp-admin/includes/user.php | |
| list_core_update() wp-admin/update-core.php | Lists available core updates. |
| list_plugin_updates() wp-admin/update-core.php | Display the upgrade plugins form. |
| wp_mail() wp-includes/pluggable.php | Sends an email, similar to PHP’s mail function. |
| wp_admin_css_uri() wp-includes/general-template.php | Displays the URL of a WordPress admin CSS file. |
| get_the_generator() wp-includes/general-template.php | Creates the generator XML or Comment for RSS, ATOM, etc. |
| feed_links() wp-includes/general-template.php | Displays the links to the general feeds. |
| feed_links_extra() wp-includes/general-template.php | Displays the links to the extra feeds such as category feeds. |
| bloginfo() wp-includes/general-template.php | Displays information about the current site. |
| get_index_rel_link() wp-includes/deprecated.php | Get site index relational link. |
| WP::send_headers() wp-includes/class-wp.php | Sends additional HTTP headers for caching, content type, etc. |
| WP_Http::request() wp-includes/class-wp-http.php | Send an HTTP request to a URI. |
| wp_nonce_ays() wp-includes/functions.php | Displays “Are You Sure” message to confirm the action being taken. |
| cache_javascript_headers() wp-includes/functions.php | Sets the headers for caching for 10 days with JavaScript content type. |
| WP_Widget_Meta::widget() wp-includes/widgets/class-wp-widget-meta.php | Outputs the content for the current Meta widget instance. |
| get_pagenum_link() wp-includes/link-template.php | Retrieves the link for a page number. |
| wp_admin_bar_site_menu() wp-includes/admin-bar.php | Adds the “Site Name” menu. |
| html_type_rss() wp-includes/feed.php | Displays the HTML type based on the blog setting. |
| get_bloginfo_rss() wp-includes/feed.php | Retrieves RSS container for the bloginfo function. |
| wp_prepare_attachment_for_js() wp-includes/media.php | Prepares an attachment post object for JS, where it is expected to be JSON-encoded and fit into an Attachment model. |
| filter_SSL() wp-includes/ms-functions.php | Formats a URL to use https. |
| wp_xmlrpc_server::pingback_ping() wp-includes/class-wp-xmlrpc-server.php | Retrieves a pingback and registers it. |
| wp_xmlrpc_server::initialise_blog_option_info() wp-includes/class-wp-xmlrpc-server.php | Set up blog options property. |
| WP_Customize_Widgets::enqueue_scripts() wp-includes/class-wp-customize-widgets.php | Enqueues scripts and styles for Customizer panel and export data to JavaScript. |
| wp_default_styles() wp-includes/script-loader.php | Assigns default styles to $styles object. |
| wp_default_scripts() wp-includes/script-loader.php | Registers all WordPress scripts. |
| weblog_ping() wp-includes/comment.php | Sends a pingback. |
| pingback() wp-includes/comment.php | Pings back the links found in a post. |
| wp_print_media_templates() wp-includes/media-template.php | Prints the templates used in the media manager. |
Changelog
| Version | Description |
|---|---|
| 0.71 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_bloginfo