WordPress generates shortlinks for your posts and pages. By default it uses the
?p= with the post ID added to it, but if you have a rather long domain name this isn’t very useful. If you use Bit.ly, this plugin will help you replace the shortlink WordPress generates with a proper Bit.ly shortlink.
This plugin uses the latest Bit.ly OAuth 2 draft specification API instead of its deprecated V3 API and enables you to use generic access token to automatically enable Bit.ly shortlinks in your entire multisite network without the need for each site user to have to tinker with any settings or authentication configurations.
- Upload the
pluginfolder to the
- Activate the plugin through the ‘Plugins’ menu in WordPress
Insert this code to define your bit.ly generic access token in your
wp-config.phpat the end right above “That’s all, stop editing! Happy blogging.”:
You can get your generic access token here: https://bitly.com/a/oauth_apps
Install and set up your access token the same way as a single site installation but make sure you Network Activate the plugin.
How To Call Bitly Shortlinks In Your Templates
I’ve included the function
get_bitly($url) to help developers easily shorten URLs in their templates.
<?php $url = 'http://YourLongURL.com'; echo get_bitly($url); // display your shortened URL ?>
Contributors & Developers
“Bit.ly Shortlinks Multisite (Uses OAuth 2 API)” is open source software. The following people have contributed to this plugin.Contributors
Interested in development?
- Fixed bug that occurs when
WP_ DEBUGis on (Thanks to Luke Childs for the bug find.)
- Initial release.