Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

How to Add Shortlink Menu Item in WordPress Admin Bar

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Add Shortlink Menu Item in WordPress Admin Bar

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.


Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »

Comments

  1. Joe Ndzulo says:

    Hi there team at Wpbeginner.com. Thanks a lot for this post. I have got to a level where I needed this feature back. Until recently, I had to “edit” a post to be able to get its short link. Thanks again.

  2. retlkpr says:

    wpbegginer – Thanks for the tip to find the admin bar, but I still have no idea what you are talking about. Sorry. I have a Dashboard. When I write a post I have a “Shortlink” button  which is at the end of “Permalink, Edit and then Shortlink”. Where is the Admin Bar?

    • wpbeginner says:

      When viewing the post on the front-end (not on the back-end)… often you may need to get the shortlink. Most people publish the post (Click View the Post), and then they want to share it. Normally you would have to go back to the Edit Posts screen, click on the shortlink button that you are talking about. OR you can just use the admin bar in the front-end.

      • retlkpr says:

         @wpbeginner Gotcha! Thanks for that. I never really noticed that one was there or not – guess I’ll have to use it now! :-) I must say again though that the “site-specific plugin” is going to be very useful. Thanks again.

  3. retlkpr says:

    OK, looking more closely I found it on the Posts menu – a rounded box with Shortlink in it – but that was always there in 3.3., at least in mine. Why do we need to add the code again? Maybe you are referring to something else or another location.
     
     
     
     
     

    • wpbeginner says:

      Look at the post thumbnail. In the WordPress admin bar, there used to be a shortlink menu. This allowed users like us to quickly grab the shortlink of the post when sharing. In WordPress 3.3, this feature was taken away from the WordPress Admin Bar.

  4. retlkpr says:

    Thanks for the tip on the site-specific plugin. It will be very useful.
    As for the “Shortlink” menu – What is it? What does it do? Where do I find it?
    Sorry for being so dumb, but I have no idea what you are referring to. Thanks for any insight.

  5. merrittsgret says:

    Thank you so much for this oh-so-simple but oh-so-helpful post!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.