In our last few articles we have been focusing a lot on dealing with Short URLs and WordPress. While creating our new WordPress Gallery (Submit your WordPress Site), we had to deal with few issues that we did not cover on WPBeginner. Some of those issues were “How to Display Shortlinks in WordPress Theme“, or “How to Automatically Add Custom Fields on Every Post Publish“. Well in this article, we will actually show you how to automatically generate a Bit.ly or Bit.ly PRO URL (Remember the Branded Short URLs?) for each of your posts without editing a single line of code.
After going through numerous solutions, our developers came to the conclusion to use the plugin WP Bit.ly rather than reinventing the wheel. WP Bit.ly plugin allows you to generate short links using the Bit.ly API for all of your blogs posts and pages. In addition to that, this plugin generates a new meta box on your posts that show you statistics about your link (such as who’s clicking on your links). The best part about this plugin is that it hooks into the WordPress Shortlink filter, so it can be used by you, your visitors and a variety of other services that employ them.
Then the plugin will need to be configured with your Bit.ly account. If you don’t have one, then you would need to signup to have a personalized API. To retrieve your Bit.ly API, go under the Settings Tab in your bit.ly account (Hint: it is located in the top right where your username is).
Now let’s configure the plugin. Go to Settings » WP Bit.ly in your WordPress Admin Panel.
Enter your Bit.ly Username, and the API Key. Then select your Post Types that you want to generate the link for. Click save changes and you are done.
To check if it is working, simply open your Bit.ly account, and you will see tons of new links generated. Or you can simply go to any of your post and click on the Short Link button, and you should see a box with your Bit.ly link or Bit.ly Pro link like in the image below:
This plugin is extremely easy to use, it does the job very well, and it has amazing future development plans: “Future development will include the ability to use your own domain as the short link (http://yourdomain.com/bXhGjs).”