Add a shortlink to the end of your WordPress posts

Once again, that Andy Mabbett has given me the reason to knock out a quick WordPress plugin.

This one prints out a “Shortlink for this post” link (see screenshot) to the end of all your posts. It uses WordPress’ built in shortlink feature which doesn’t always produce very short URLs so you’ll want to use one of the shortener plugins alongside it.

You should also consider activating this shortlink plugin too which adds machine-readable references to the shortlink in the code for each page.

Download the plugin here and then,

  1. Unzip and upload add-shortlink-to-posts.php to your /wp-content/plugins directory
  2. Login to your dashboard
  3. Go to Plugins and activate the Add Shortlink to Posts plugin
  4. Check it works okay

WARNING: This has not been tested extensively and may well cause a black hole to open up and swallow your dog. Ensure you have a back up before trying out any untested plugins like this one.

If you do get it working, I’d appreciate you letting me know in the comments including what version of WordPress you are using and whether it’s a Multisite or not.

8 thoughts on “Add a shortlink to the end of your WordPress posts”

  1. Thank you. Working well on which is a single-site install of the latest version, v3.1.1

    I notice, though, that the link is added within and at the end of – the “.entry-content” div. Could it perhaps go in the “entry-utility” div, or is that skin-dependent?

    The pedant in me would like you to add rel=”shortlink”, too, please ๐Ÿ˜‰

  2. rel=”shortlink” added, just download it again ๐Ÿ™‚

    The entry-utility bit is theme specific. This plugin hooks into “the_content” – i.e. it does the machine equivalent of editing your post and adding the link using the visual editor which WP then puts into that div.


  3. I really like this, and thank you for developing it, but I wonder if the short code could appear in a small text box: something that one would obviously cut and paste. As it is, people might click the link instead of copying and pasting the link reference. Clicking the link takes you exactly to the long form URL words-based permalinks are good for

Leave a Reply

Your email address will not be published. Required fields are marked *