I got tired of waiting for a “proper” YOURLS WordPress plugin to come out, so I did it myself. Hey, I’ve got other stuff to do, and I needed a working shortlink solution.

Basically, this is the “YOURLS: WordPress to Twitter” plugin, with all the Twitter bits removed.

While I was in there, I also fixed the password saving bug that I kept having in Chrome (just cut out the submit button JS), switched it to eliminate the Pear_JSON package entirely (WordPress has JSON support built in already), and did some other minor things. I’m sure I missed some bits, but for the most part it was really just a hack and slash job. Eliminated about 30% of the plugin’s main code and all the ancillary Twitter libraries.

On a side note, this sort of thing only reinforces something I’ve said before: Plugins should only try to do one thing, and to do it well. Trying to have a twitter solution in this plugin when I didn’t want to use that bit at all basically just made it stop doing the shortlinks correctly. That’s a real problem when it’s really a shortlink plugin to begin with. I already had a really good twitter solution, trying to have all this extra crap in there just made it not work properly.

If I had more time, I’d also remove all the JS stuff on the settings page too. That’s not really necessary when you only have a few fields to enter. But I guess it works, sort of. Whatever. Not important.

Anyway, here you go. I won’t be putting this in the plugins repository, since it’s not really my code. But I am posting it here in case it helps anybody. And if Ozh changes his plugin to eliminate the Twitter stuff (or to at least make it optional without impacting functionality), then it would be worth switching to that in the future. I won’t be supporting this plugin anytime soon.

YOURLS – WordPress (no Twitter)

Edit: Note that I did this mainly because I wanted to use my own Simple Twitter Connect instead for posting items to Twitter. That works fine and uses the shortlink from this plugin fine. But the extra Twitter stuff in the original plugin interfered with it, and there was no good way to disable that stuff short of editing the plugin. I’m a fan of not editing other people’s plugins, but in this case there really wasn’t a lot of choice. YOURLS is a good system and I like using it, I just wish the WP plugin for it wasn’t trying to do so much. Just so you know. 🙂



  1. Heh, nice job 🙂
    For the record, when I first implemented the tweet capabilities, my first thought was “I’ll get people use Otto’s STC”. I don’t remember why I didn’t stick to this… Probably wanted to learn how things worked myself 🙂

  2. Otto!

    I just noticed that the auto publish feature of Simple Twitter Connect is not shorting the URL.

    P.S.: Tweets using the publish feature of the dashboard are being shorted.

    What should I do?

  3. Otto,

    Please, see if you can give me a hand here…

    I´ve already set the auto publish feature on twitter and facebook, but I still have those 2 problems:

    1 – Facebook
    The auto publish only works if I set the plugin to publish on my Facebook profile and also on my Facebook Fan page. I´d like to publish only at the fan page, but if I set the plugin like this, it didn´t publish my post on my facebook´s fan page.

    2 – Twitter

    Simple twitter connect still doesn´t short de URL when I use the auto publish feature, but when I use the twitter on the dashboard it works fine and short the URL as expected.

    Do you have any ideia of why this is happening on my blog?

  4. Otto!

    I´ve finally fixed this problem!

    The original plugin was also installed, but it was set to inactive. I just removed the original plugin and your modified plugin starts to work correctly.

  5. Sorry ! But I have a silly doubt. The actual Yourls plugin was updated at March-7.
    Is your modified plugin updated accordingly ? I hope you keep updated the plugin accordingly in the future too

    Thanks !

  6. Please, Otto, Help me

    1. My Yourls instalation have the 1.4.3 version;

    2. I use the Ozh Plugin until the last version of it, and never had a problem, but when I upgrade for this last version, I can’t connect my plugin with the twitter more. Then, I can’t send my messages of posts published in wordpress to twitter;

    3. My English is bad. I want know that your plugin correct this problem. I try read the post, my I didn’t understood.

    4. If I change the Ozh Plugin by the your plugin, can I send the posts to twitter?

    thanks if you can answer me in my e-mail, please.

  7. […] integration, so I didn’t need the extra stuff. Luckily, neither did Otto. Here’s a version of that plugin with the fluff removed. It just takes care of making the shortlinks. It works perfectly here on […]

  8. Thank you for the plugin. Is there any chance it’ll get updated to integrate the new unicode plugin?

  9. Pretty good job Otto! Exactly the version of the Yourls plugin I was looking for!

    Thanks a lot.


  10. […] – afin de fonctionner normalement. Naviguant un peu sur la toile, j’ai découvert ce module modifié qui supprime intégralement la partie « Twitter » de l’extension […]

  11. Just ran into this issue when using this:

    Multiple calls on the page results in multiple INSERTS which run concurrently. I had to disable and revert to a backup db. 🙁

  12. Hi, I’m using latest versions of Yourls and WP, I also installed this great plugin, and it works, but something is wrong, coz then I crete a post in my blog it isn’t tweeted but the link is automatically made in my YOURLS without any problem.

    In the plugin configuration all windows are green (looks like OK!) and I checked a lof of times the manual. WP says that connection to my tweeter is correct.

    Any idea ?


  13. Hi, works fine, but when trying to publish to twitter i get error “Status contains malware” from post inside WordPress, please help ! 🙁

    Promote this Entrada on @wtitter:

    Status contains malware

  14. Otto,

    When I try to authorize the plugin from a Multisite install, I get this error:

    Fatal error: Cannot redeclare class OAuthSignatureMethod_HMAC_SHA1 in [snipped]/wp-content/plugins/simple-twitter-connect/OAuth.php on line 82

    Any idea what it means and how I can avoid it. (sorry for the newb question)

  15. Hi Otto, have you upgraded your Yourls install at all? I was cruising around the yourls site, and noticed a lot of bugfixes in the trunk version, so I upgraded (version 1.5.1). When I run that version, the plugin link breaks somewhat. New links are generated, but they aren’t reported back to the site… seems something is breaking the ability to report back. I rolled back to the 1.5 version, and all is well. So I’m not looking for support or anything, I’m back in action…. just checking to see if you had successfully upgraded at all to see if it was something on my end. Other than that, just a heads up I guess, something will most likely break the plugin in a future Yourls release. Regardless, thanks for the modded plugin, love it!

  16. When I installed this plugin it does make duplicate entries for a single URL. I saw that each time I went to a old post the admin would display 4 short urls for that post. The official plugin does not have this problem.

  17. Hi Otto, Thanks for this! I did make a slight change to use the YOURLS API Signature instead of username and password! Hope you don’t mind I’ve stuck my version on Github here.


  18. […] but it had all kinds of funky Twitter integration that I didn’t want. Next I manage to find a modified version which did all the hooking up of your WordPress and YOURLS but left Twitter out, perfect. Well […]

  19. Hi Otto,

    I hope you can help me, add this feature:

    Shorten the URL what i field in the custom fields,for example:

    custum fields: longurl http://www.abcdefjhijk.com

    and get the result:

    custum fields: shorturl http://a.com/abc

    Thank you very much.

  20. Hey Otto, did you run into any problems with your modified plugin after the 3.5 upgrade? I’ve been using your modified plugin since you put it out, and it’s always worked perfectly until now. When I try to publish a post, I’m guessing when the short URL attempts to get generated, my site redirects to my Yourls install page URL and tells me it’s already installed. The post publishes but no short URL generates. On the front end, if I click from my index page on a post, instead of going to the single view it redirects to my Yourls install link. Pretty strange. I checked in the settings, and I have the green light on connection still.

    • I haven’t made a new post with 3.5 final yet, but it worked fine with the betas.

      • I’ll have to dig deeper and see if I can tell what is going on, thanks!

      • Tell me this isn’t whacky…. I killed all plugins but yours and ran the vanilla 2012 theme. Still have the same problem. But everything is fine on my various other sites. Just happening on VoodooPress. What on earth could even cause a redirect to my yourls install URL? I don’t actually expect anything… just wanted to report back that it’s an isolated incident to one site, and I have no idea what could be causing it! I mean, same plugin on all sites using the same Yourls install… everything is the same, but one site has just decided to go completely BONK!

      • Ha.. sorry to keep bugging you, just want to throw more info your way in case it’s relevant at all. It seems the issue actually does happen across all my sites. It just doesn’t trigger until I make a post. rvoodoo.com was working groovy, but I hadn’t made a new post after upgrading. I just made a new post and now that site also exhibits the same symptoms I mentioned above.

  21. Hi there =)! Is there a php script for this aswell? So i can put the generated shortlink in the footer?

  22. I need some help with this plugin please….
    How do I send to my yourls script not the PostID but the actual link that is included in the title of post?

    Thank you!

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

Need to post PHP code? Wrap it in [php] and [/php] tags.