Simple URL Shortener
Simple URL Shortener will shorten a supplied URL using one of over 100 online services.
Description
From version 1.6 you must install the WP Plugin Cache plugin to be able to cache the shortened URLs.
Simple URL Shortener is the simplest, yet most powerful URL shortening plugin available, with over 100 shortening services available.
The code to access Simple URL Shortener can be put anywhere within your WordPress theme, where you need to convert a long URL to a short one.
Here is an example...
<?php echo simple_url_shortener('http://www.artiss.co.uk','is.gd'); ?>This will display the is.gd shortened URL for http://www.artiss.co.uk.
There are 2 parameters..
The first parameter is the URL that you wish to have shortened. If left blank it will use the URL of the current post/page.
The second parameter is the shortening service that you want to use - see the seperate tab for a full list.
Here is a further version of the original example, but this time with a check to confirm that the plugin is active...
<?php if (function_exists('simple_url_shortener')) : ?>
<?php echo simple_url_shortener('http://www.artiss.co.uk','is.gd'); ?>
<?php endif; ?>From version 1.6 you must install WP Plugin Cache to provide a cacheing feature whereas the shortened URL is only fetched once from the shortening service provider - after that it is saved and retrieved from a cache. This greatly improves performance.
However, even with the plugin installed you can still switch it off via the second parameter. When doing this, the service name must be prefixed. For example, using the above example, but switching the cache off, you'd type...
<?php if (function_exists('simple_url_shortener')) : ?>
<?php echo simple_url_shortener('http://www.artiss.co.uk','service=is.gd&cache=no'); ?>
<?php endif; ?>Note the ampersand which is separating the parameters.
Some of the shortening services require additional information. Again, this can be supplied via the second parameter. The three new sub-parameters are apikey=, login= and password= and represent a supplied API Key, a login ID and a password.
bit.ly+key, 9mp, j.mp+key and to.vg requires before
apikeyandloginto be specified.coge.la+key and linkbee+key requires
loginandpasswordto be specified.307.to+key, adjix, ad.vu, cort.as+key, ez.com, l.pr, Puke.it, qux.in, tra.kz, url.co.uk and urlBorg require the
apikeyto be supplied.
For example, here is the above example, but now using bit.ly+key as the shortening service...
<?php if (function_exists('simple_url_shortener')) : ?>
<?php echo simple_url_shortener('http://www.artiss.co.uk','service=bit.ly+key&apikey=3003948393993&login=test&cache=no'); ?>
<?php endif; ?>I've not used a valid API key in the above example - you will need to get one for yourself.
If you are having issues with the URL not being shortened, then a final sub-parameter of debug=yes is available. This will output useful information about the shortening process, including any attempt to cache.
For help with this plugin, or simply to comment or get in touch, please read the appropriate section in "Other Notes" for details. This plugin, and all support, is supplied for free, but donations are always welcome.
Developers
It is envisaged that this plugin is probably more of use to developers who want to include it as part of something else. In particular, this plugin can be called from another - for example, a Social Bookmarking plugin could use this to provide a number of possible URL shortening services.
To this end another routine is provided, validate_url_shortener, which can be used to validate whether a shortening service is valid.
This routine has two parameters. The first parameter is a line of text that you wish to have checked to see if it included a validate shortening service.
The second, optional, parameter is a mask. Use the text {service} to indicate where in the mask the name of the service should appear.
If the shortening service was valid, the name of it will be returned.
Let's try some examples...
validate_url_shortener('is.gd','');This will return is.gd if is.gd is, indeed, one of the shortening services that this plugin accepts. Otherwise a null will be returned.
validate_url_shortener('Is there a shortening service in this sentence is.gd','');Again, this will return is.gd, as it was found within the first parameter.
validate_url_shortener('Start %is.gd% End','%{service}%');This time a mask has been specified showing that the service should appear within percent signs. As a valid service is found within the first parameter in this format, it will be valid and is.gd will once again be return.
In this example, a null will be specified as the mask condition was not met...
validate_url_shortener('Start is.gd End','%{service}%');Use this routine in conjunction with the actual shortener to validate passed services before then using them. However, if simple-url-shortener is passed a service that is not valid, it will simply return the original URL.
Services
The following shortening services are available with this plugin...
1URL.com, 2Zeus, 3.ly, 307.to, 307.to+key, 9mp, a.gd, a.nf, abbrr, ad.vu, adjix, arm.in, BudURL, bit.ly+key, buk.me, chilp.it, clck.ru, cli.gs, coge.la, coge.la+key, cort.as, cort.as+key, durl.me, ez.com, fa.by, fon.gs, fwd4.me, gl.am, gurl.es, hex.io, hop.im, href.in, HURL, idek.net, ir.pe, is.gd, ito.mx, j.mp, j.mp+key, kissa.be, kl.am, kore.us, korta.nu, Kots.Nu, krz.ch, l.pr, Lincr, Linkbee, Linkbee+key, Linkee, LinxFix, liurl.cn, Lnk.by, ln-s.net, ln-s.ru, lt.tl, lurl.no, merky.de, micURL, migre.me, min2me, minify.us, minilink, MinURL, nbx.ch, ndurl, p.ly, Pendek.in, Piko.me, PiURL, Puke.It, qlnk.net, qr.cx, qux.in, r.im, rde.me, redir.ec, retwt.me, ri.ms, s4c, safe.mn, sai.ly, short.ie, short.to, shortn.me, Shw.me, sl.ly, smsh.me, snkr.me, srnk.net, srs.li, su.pr, su.pr+key, TimesURL, tinyarro.ws, tinyurl, to.ly, toGOto.us, tr.im, tra.kz, twirl, twiturl.de, u.nu, UiopMe, unfake.it, url.co.uk, ur.ly, url.ag, urlBorg, urlG, urlKiss, urlShort, vb.ly, vl.am, vtc.es, xr.com, xrl.us, xxsURL, z.pe, Zi.pe, ZipMyURL, zz.gd
Licence
This WordPRess plugin is licensed under the GPLv2 (or later).
Support
All of my plugins are supported via my website.
Please feel free to visit the site for plugin updates and development news - either visit the site regularly, follow my news feed or follow me on Twitter (@artiss_tech).
For problems, suggestions or enhancements for this plugin, there is a dedicated page and a forum. The dedicated page will also list any known issues and planned enhancements.
Alternatively, please contact me directly.
This plugin, and all support, is supplied for free, but donations are always welcome.
Reviews & Mentions
Custom Short URLs in WordPress
Behind the Scenes - The Brooks Review
How to make a Twitter button with your choice of service URL
Installation
- Upload the entire simple-url-shortener folder to your wp-content/plugins/ directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- There is no options screen - configuration is done in your code.
Frequently Asked Questions
You haven't included my favourite URL shortening service
Just let me know and I'll possibly include it in a future release. I'm trying to just include the most popular services, as there are hundreds available.
Which version of PHP does this plugin work with?
It has been tested and been found valid from PHP 4 upwards.
Changelog
1.0
- Initial release
1.1
- New versions of shared functions added in
- Now uses caching system to save shortened URLs
- Sub-parameter system added to allow for switching off of cache
1.2
- Added 87 new shortening services. pic.gd removed.
- Ability to specify API key and/or login and password details for certain services
- Can now read XML and JSON return formats, not just plain text
- Failed shortening of URLs are no longer cached
1.3
- Added new services - 2Zeus, 9mp, BudURL, HURL, kl.am, Lnk.by, to.vg, url.co.uk
1.4
- Replaced str_ireplace with str_replace to ensure PHP 4 compatibility
1.5
- Added debugging facility
1.6
- Rewrite of main code, especially debugging data
- Using WP Plugin Cache for caching, instead of old internal routines
- Added extra Linkbee service for members
- Added ez.com and minify.us to list of services
- url.co.uk now requires an API key
- Fixed critical bug in file fetching routine
- Confirmed WP 3.0 compatibility
1.6.1
- Added v.gd
- Removed bit.ly (you can still use bit.ly+key though)
1.6.2
- Fixed file fetching bug

Known Bugs
No bugs are currently recorded.
Planned Enhancements
No enhancements are currently planned.
















Copyright © 2000-2012
Artiss.co.uk is checked by
I want to use this with bw.ly which I own I was going to upload WP to that – so do I understand this URL shortener I have to use one of the ones listed here? How can I use my own?
Hi Larry.
I’d put a facility in to define your own, but there are so many different ways that the API works, it would be difficult to do so.
If it’s one that’s not exclusively for yourself and has an API of some kind, then let me know the details and I’ll get it added.
We’ve been using simple twitter link (and URL shortener since 1.5) to put a twitter link on each of our posts, but it seems like with each update it becomes more and more difficult to have things display properly. Currently, instead of a twitter link, we’re showing an error message:
Simple URL Shortener: Could not update cache file …/simple-url-shortener/cache/c2bb4c9e31be9949ac09e2104a3685b2a3aa60e0.suc
This started happening after the latest update of Simple URL shortener.
Before the last update, this code worked fine for providing a twitter link for us.
Is there something in the new update of Simple URL shortener that isn’t working with Simple Twitter Link? I can’t figure out what to do.
Any help is appreciated.
The first thing to do is to confirm the attributes on the cache folder – ensure it is fully writable.
If that doesn’t work the latest version of the plugin has an option to turn off the caching – that certainly should resolve the issue!
I had the same problem as Local Landing I think and resolved it by creating the cache folder manually since for some reason it didn’t exist after installing the plugin.
Works great now, thanks!
Is this compatible with the Shaun Inman “LESSN” personal URL shortener? It has an API ( which I use on my iPhone with Tweetie2).
LESSN is free URL Shortening service that you can install on your own domain. This means that there’s no fixed URL associated with it – currently, as this plugin stands, that’s not supported.
Besides, I’ve taken a quick look and API details are not obvious. I can see an API key is present and there’s a bookmarklet option available, but I can’t find any API documentation. As much as I’d love to have to install and work it out from scratch via the code… no, I won’t
Anyway you can add http://minify.us to the included shorteners?
I’ve taken a quick look and it uses a compatible API, so I’ll add it to the next release!
Can you update your plugin to make linkbee use login= and password= to shortner links to our member accounts?
I will look at doing this for the next release!
hey man! wonderful plugin, but it can not really install it in my wordpress..(sry my english)
there only comes this window (screenshot)
[url removed]
what do i wrong?
thanks for help
I’ve attempted to contacted you via email about this and have not had a response. The screenshot URL you provided is not valid.
I have installed, removed, and reinstalled this plug-in three times now, but it is not showing up in my menu after activating it. I am using the latest WP version; are there compatibility issues? Or, am I just completely miss understanding how to install the plugin? hahah..
Thank you,
Dennis
The latter
No menu options appear when this is activated – it is called by PHP code that you have to add to your theme files.