Put site ID by “Howdy” greeting in WordPress

Grabs the site ID and puts it by the “Howdy” greeting in the upper right hand corner of your WordPress dashboard.

For super admins it’s a link, for regular admins it’s plain text.

Update: This feature has been bundled into the Howdy Tweaks plugin.

Just toss in your function.php file.

<?php
	add_filter('admin_user_info_links','blog_id_in_howdy_greeting');

	function blog_id_in_howdy_greeting($links) {
		global $blog_id;

		if ( is_super_admin() ) {
			$links[] = ' | <a href="/ms-sites.php?action=editblog&id=' . $blog_id . '">Site ID: ' . $blog_id . '</a>';
		} else {
			$links[] = ' | Site ID: ' . $blog_id;
		}
		return $links;
	}
?>

Easy to modify it you want to remove the number from regular admin’s view all together.

Note: Since WordPress 3.3, this does not work, but the Howdy Tweaks plugin is up-to-date.

Leave a Reply

Your email address will not be published.

%d bloggers like this: