How to Add Shortlink Menu Item in WordPress Admin Bar

110

In WordPress 3.3, in an effort to minimize clutter, WordPress UI team revamped the admin bar. In the process, they took away a quite useful feature “Shortlink” menu from the admin bar. We’re sure the reasoning probably was that not enough folks utilize that feature however from all the power users we have talked with, they all said they found this feature quite handy. For WPBeginner, we have a branded shortlink (wpbeg.in), so we needed this feature badly. We asked the developers of the WP-Bit.ly plugin to add this feature in their plugin because we use them for automatically generating branded short url. When no action was taken, we dugg in the core and it was quite easy to re-add the menu item back. So we added the one line of code, and there we have it. In this article, we will show you how you can add the Shortlink Menu back to your WordPress 3.3 admin bar.

All you have to do is add the following line of code in your functions.php file or in your site-specific plugin file:

add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu',90 );

That’s all you have to do.

For those users who want this feature without messing with code, we did a quick research and found the plugin Renee Shortlink Item in Admin Bar. The code for this plugin is just that one line as well, so it is very minimal. Activate and Forget about it.