The bloginfo WordPress PHP filter allows you to modify the site information returned by the get_bloginfo()
function.
Usage
add_filter('bloginfo', 'your_custom_function', 10, 2); function your_custom_function($output, $show) { // your custom code here return $output; }
Parameters
$output
(mixed): The requested non-URL site information.$show
(string): Type of information requested.
More information
See WordPress Developer Resources: bloginfo
Examples
Modify Site Title
Change the site title by appending a custom text.
add_filter('bloginfo', 'modify_site_title', 10, 2); function modify_site_title($output, $show) { if ($show == 'name') { $output .= ' - Custom Text'; } return $output; }
Change Tagline
Update the site tagline by prepending a phrase.
add_filter('bloginfo', 'change_site_tagline', 10, 2); function change_site_tagline($output, $show) { if ($show == 'description') { $output = 'New Phrase - ' . $output; } return $output; }
Modify RSS Feed Description
Add a custom prefix to the RSS feed description.
add_filter('bloginfo', 'modify_rss_description', 10, 2); function modify_rss_description($output, $show) { if ($show == 'rss2_head') { $output = 'Custom Prefix: ' . $output; } return $output; }
Change Charset
Modify the charset returned by bloginfo.
add_filter('bloginfo', 'change_charset', 10, 2); function change_charset($output, $show) { if ($show == 'charset') { $output = 'UTF-8'; } return $output; }
Update Language Attribute
Customize the language attribute in the HTML.
add_filter('bloginfo', 'update_language_attribute', 10, 2); function update_language_attribute($output, $show) { if ($show == 'language') { $output = 'en-US'; } return $output; }