YOURLS (Your Own URL Shortener) is a URL shortener, like TinyURL, except it's all GPL and you can run it on your own server, publicly or for your own use only. It was made by Lester Chan and myself. Learn more about YOURLS.
This plugin, YOURLS: WordPress to Twitter, is the bridge between YOURLS and your blog: when you publish a post or a page, it will use your own YOURLS install, either hosted on the same webserver, or another server, to create a short URL for your post.
Download
Extract and upload to your blog, preserving directory structure.
Enjoy.
Note: the plugin requires PHP 5 to run.
Template Tags for you theme
The plugin comes with two template tags:
wp_ozh_yourls_url()
Will echo a HTML link with short URL (will generate it on the fly if needed) for the current post.
Example output:
<a href="http://ozh.in/j5" rel="nofollow alternate shorter" title="short URL">http://ozh.in/j5</a>
Suggested use: in the loop, in single.php, in page.php
wp_ozh_yourls_head_linkrel()
Will output a <link/> in <head> for the current post (see revcanonical.appspot.com and shorturl.appjet.net for more info)
Example output:
<link rel="alternate short shorter shorturl" href="http://ozh.in/j5" />\n
Note that WordPress echoes this <link> out of the box so you mostly won't need this one.
You can also use two other functions in your code and plugins:
wp_ozh_yourls_raw_url()
Will return (or echo if you pass true to it) the short URL, with no HTML tag or anything else. Just the raw URL.
wp_ozh_yourls_geturl( $id )
Will return (and generate on the fly if necessary) the short URL for post with id $id
Easy custom keyword
If you want your post to have a custom short URL instead of the random/sequential generated one, when you write a new post add a new custom field to it (button: "Add Custom Field") with name "yourls-keyword" and your custom keyword as a value.
Filters all over the place
If you're a coder and want to interact with the plugin, there are a lot of filters for you to do so. Just read the source and look for what you need (and if you cannot find what you need because you'd like another filter somewhere else, please tell me!)
Shorter URL
Want to share or tweet this page? Please use this short URL: http://ozh.in/m7
Hello,
I've been using the plugin on a couple of sites and now it is starting to fail, I assume that this is down to the Twitter API changes?
My personal site slows to a halt when the plugin is activated now :(
Any updates or tweaks I can make?
I have the same issue with the oauth.
only
Logged on Twitter as @ ( followers)
is displayed…
When will there be a solution?
I have lost the twitter write field alltogether..
:-(
Is this been updated? cos i cannot see 'yourls-api.php' file. and the Plugins name has changed, so the file directory were not the same as your guide.
What should i choose if i installed the plugins in http://www.angelsempire.net//public_html/wp-content/plugins ? Local or Remote server?
Please advice,
Many thanks
aldy » You didn't understand what the plugin is for. You won't find any yourls-api.php in that plugin.
Hi Ozh,
I have the same problem like the other people. Failure:
Could not authenticate with OAuth.
How can we fix this problem?
Best Regarts
Sven
Hi,
Updated to wordpress 3.5 and YOURLS 1.5.5
When submitting all details, pressing save changes goes to my local YOURLS install.php and does not save twitter settings.
Help?
Cheers!
Hi!
Yourls is not working on WordPress 3.5.
Please, help us! :)
Plugin updated: all Twitter related functions removed. Read the plugin page for more.
Last plugin update broke WP backend
Makis » Doh, much apologies to that, I had uploaded an incomplete file. This is fixed, I've just committed 1.6.1
No need to apology :)
It was a good opportunity for me to thank you about your short url development and this plugin all together.
I updated to the latest version of the YOURLS WP plugin yesterday, but it's redirecting me to install.php when I try to publish a new post on WP 3.5 and doesn't shorten the link. Is this a known bug? Is there anything I can do?
Thanks so much for providing Twitter support in the past. We've surely been spoiled with it. It's another sign that the Twitter API guidelines will only hurt the company.
I have exactly the same problem that Bob Decker has just mention it.
Bob Decker & Igor » I cannot reproduce this, using "Remote" or "Local" works fine for me. What version of YOURLS are you using? Did you try resetting all settings and configure the WP plugin again?
I am on YOURLS 1.5. What settings should I try resetting? This didn't start occurring until I upgraded to WP 3.5.
@Ozh @Bob Derek
I have reseted my plugin setting and now Yourls 1.6.1 is working fine.
Thanks! :)
1.6.1 seems to not be working with WordPress 3.5.1 and 3.5.2 (just did the update to make sure). Sometimes after publishing a post, the Yourls page appears with an error saying it's already installed. Other times, it seems as if everything has worked, but no short link gets generated. I'm unaware of anything on my server that has changed other than wordpress versions. The last short URL that my installation created automatically was in April. My bookmarklet is still working correctly.
I should add to my earlier comment that per other comments here, I clicked the "reset" link in the plugin and re-entered my path to the server, but that didn't fix it.
Great plugin, Thanks! It works perfectly if I have my caching plugin turned off… but when I have W3 Total Cache with Cloudflare turned on I get a ton of duplicate short urls created for each post. Any ideas what could be causing that? Any fixes? Also, I see there is a generate a new URL when "New Media published" but I can't seem to get that to work. I'm trying to get short URLS for the featured image on every blog post, any way to do that?
This plug-in installed, there is a long time and slow before entering the installation interface
Excelent!!! I love Yourls and WordPress!