Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LittleCoding/d3e72f329a622606eb9337d7ca6ee0f7 to your computer and use it in GitHub Desktop.
Save LittleCoding/d3e72f329a622606eb9337d7ca6ee0f7 to your computer and use it in GitHub Desktop.
Change "Site Name" menu in WordPress administration menu bar
<?php
/**
* code to be placed in theme functions.php
* Default behavior is to ellipse $blogname at 40 characters.
* add_filter priority of 30 or greater.
*/
if ( ! function_exists( 'mytheme_admin_bar_menu' ) ) {
function mytheme_admin_bar_menu( $wp_admin_bar ) {
$site_name = (object) $wp_admin_bar->get_node( 'site-name' );
if ( ! empty( $site_name->title ) ) {
$site_name->title = 'My Site';
$wp_admin_bar->add_node( $site_name );
}
}
add_filter( 'admin_bar_menu', 'mytheme_admin_bar_menu', 30 );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment