Warning: Creating default object from empty value in /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php on line 31

Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/yourls-wordpress-to-twitter/plugin.php on line 73

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/yourls-wordpress-to-twitter/plugin.php on line 73

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/wp-super-cache/wp-cache-phase2.php on line 62

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 630

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/plugins/ozh-who-sees-ads/wp_ozh_whoseesads.php on line 631

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/themes/planetozh/functions.php on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/planetozh/planetozh.com/blog/wp-content/plugins/paged-comments/paged-comments.php:31) in /home/planetozh/planetozh.com/blog/wp-content/themes/planetozh/functions.php on line 173
YOURLS WordPress (a Short URL Plugin) « planetOzh
On: 2009/06/25 Viewed: 58359 times
Shorter URL for this page: http://ozh.in/m7

yourls-logoYOURLS (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.

The latest version of the plugin does not support Twitter any longer. I have not enough free time to maintain that part, due to the regular changes from Twitter on their authentication process. If you want to auto tweet your posts, use a plugin for that.
This plugin is not maintained any longer. It's still working probably fine (here on this blog for instance) but I'm not investing any more time on it. No support or anything.


Download the plugin : yourls-wordpress-to-twitter.zip
Extract and upload to your blog, preserving directory structure.

Note: the plugin requires PHP 5 to run.

Template Tags for you theme

The plugin comes with two template tags:

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

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:

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


This page "YOURLS WordPress (a Short URL Plugin)" was posted on 25/06/2009 at 10:15 pm
Watch this discussion : Comments RSS 2.0.

472 Blablas

    Pages: « 1 2 3 4 5 6 7 8 9 [10] Show All

  1. 451
    Mike R United Kingdom »
    thought, on 23/Oct/12 at 12:37 pm # :


    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?

  2. 452
    Peter R Austria »
    wrote, on 26/Oct/12 at 10:39 am # :

    I have the same issue with the oauth.
    Logged on Twitter as @ ( followers)
    is displayed…

    When will there be a solution?

  3. 453
    Pisosse Denmark »
    said, on 13/Nov/12 at 2:55 pm # :

    I have lost the twitter write field alltogether..


  4. 454
    aldy Indonesia »
    said, on 26/Nov/12 at 4:14 pm # :

    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

  5. 455
    Ozh »
    thought, on 27/Nov/12 at 3:07 pm # :

    aldy » You didn't understand what the plugin is for. You won't find any yourls-api.php in that plugin.

  6. 456
    hobscotch Germany »
    said, on 09/Dec/12 at 7:47 am # :

    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

  7. 457
    Eitan Israel »
    wrote, on 12/Dec/12 at 5:18 pm # :


    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.



  8. 458
    Igor Brazil »
    wrote, on 14/Dec/12 at 3:17 pm # :


    Yourls is not working on WordPress 3.5.

    Please, help us! :)

  9. 459
    Ozh »
    thought, on 16/Dec/12 at 11:23 pm # :

    Plugin updated: all Twitter related functions removed. Read the plugin page for more.

  10. 460
    Makis Greece »
    commented, on 16/Dec/12 at 11:32 pm # :

    Last plugin update broke WP backend

  11. 461
    Ozh »
    commented, on 16/Dec/12 at 11:44 pm # :

    Makis » Doh, much apologies to that, I had uploaded an incomplete file. This is fixed, I've just committed 1.6.1

  12. 462
    Makis Greece »
    replied, on 17/Dec/12 at 12:00 am # :

    No need to apology :)
    It was a good opportunity for me to thank you about your short url development and this plugin all together.

  13. 463
    Bob Decker United States »
    replied, on 17/Dec/12 at 6:12 pm # :

    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.

  14. 464
    Igor Brazil »
    thought, on 17/Dec/12 at 6:54 pm # :

    I have exactly the same problem that Bob Decker has just mention it.

  15. 465
    Ozh »
    wrote, on 17/Dec/12 at 10:11 pm # :

    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?

  16. 466
    Bob Decker United States »
    said, on 17/Dec/12 at 10:20 pm # :

    I am on YOURLS 1.5. What settings should I try resetting? This didn't start occurring until I upgraded to WP 3.5.

  17. 467
    Igor Brazil »
    wrote, on 17/Dec/12 at 10:59 pm # :

    @Ozh @Bob Derek

    I have reseted my plugin setting and now Yourls 1.6.1 is working fine.

    Thanks! :)

  18. 468
    Walter United States »
    thought, on 12/Jul/13 at 5:56 pm # :

    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.

  19. 469
    Walter United States »
    replied, on 12/Jul/13 at 6:11 pm # :

    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.

  20. 470
    Justin King United States »
    thought, on 20/Sep/13 at 6:21 pm # :

    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?

  21. 471
    bay like China »
    wrote, on 22/Oct/13 at 5:49 am # :

    This plug-in installed, there is a long time and slow before entering the installation interface

  22. 472
    Alessandro Oliviero Degiusti Argentina »
    thought, on 20/Dec/13 at 11:51 pm # :

    Excelent!!! I love Yourls and WordPress!

Pages: « 1 2 3 4 5 6 7 8 9 [10] Show All

Leave a Reply

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.