{"id":9544,"date":"2020-08-29T11:11:52","date_gmt":"2020-08-29T08:11:52","guid":{"rendered":"https:\/\/vipestudio.com\/?p=9544"},"modified":"2020-08-27T11:18:45","modified_gmt":"2020-08-27T08:18:45","slug":"a-guide-to-shortlinks-for-wordpress","status":"publish","type":"post","link":"https:\/\/vipestudio.com\/en\/a-guide-to-shortlinks-for-wordpress\/","title":{"rendered":"A Guide to Shortlinks for WordPress"},"content":{"rendered":"<p style=\"text-align: left;\">Remember that time when that link you were trying to post on social media overshadowed the post itself, or you ran out of characters? And even if that didn\u2019t happen, maybe the alphabet (and number and symbol) soup in the link string just didn\u2019t go with the look you had in mind?<\/p>\n<p style=\"text-align: left;\">Sounds like you are (and were) in the market for shortlinks!<\/p>\n<p style=\"text-align: left;\">True to their name, shortlinks are shorter versions of links (URLs) that, when clicked, point to the actual (long, unwieldy) URL for the page.<\/p>\n<h2 style=\"text-align: left;\">Why Do You Even Need Shortlinks with WordPress?<\/h2>\n<p style=\"text-align: left;\">Well, we did look at a couple of use cases up there, but here\u2019s a more comprehensive set of reasons for choosing the shortlink life:<\/p>\n<ul>\n<li>Character Counts and Simplification<\/li>\n<li>Aesthetics<\/li>\n<li>Analytics<\/li>\n<\/ul>\n<p style=\"text-align: left;\">Character Counts and Simplification &#8211; Let\u2019s get the obvious one out of the way \u2013 yes, every time you have a Twitter post or tiny text box situation, the trusty shortlink has you covered. The URL gets put in its comfy space, and your text can really shine.<\/p>\n<p style=\"text-align: left;\">Aesthetics &#8211; Shortlinks are quite a bit easier on the eye. They look tidy, reliable and manageable, particularly when the original URL looks like a mess. Add to that the convenience of putting your brand front and center with custom shortlinks, and it\u2019s obvious why you need them.<\/p>\n<p style=\"text-align: left;\">Analytics &#8211; If you\u2019d like to track metrics like numbers, dates and times of clicks or client devices used, a lot of link shorteners will let you do just that. You can of course use Google Analytics to achieve the same result, but it never hurts to have multiple sets of digital eyes on your data.<\/p>\n<p style=\"text-align: left;\">Disclaimer, though: A shortlink isn\u2019t a cure-all. Sometimes the page preview that a full URL can provide brings more value (and clicks) to the table. Feel free to try out both and see what works for your specific needs.<\/p>\n<h2 style=\"text-align: left;\">Creating Shortlinks in WordPress<\/h2>\n<p style=\"text-align: left;\">Bitly and all the other third party link-shorteners are all over the internet landscape, but we can get our own shortlinks made from right <a href=\"https:\/\/vipestudio.com\/en\/wordpress-website-development\/\">inside WordPress<\/a>.<\/p>\n<p style=\"text-align: left;\">WordPress versions before 4.4 had a button to create and assign a shortlink to the page in question. The good news is that we can bring that button back with just a little code. Read on:<\/p>\n<h3 style=\"text-align: left;\">The code itself.<\/h3>\n<p style=\"text-align: left;\">This part is pretty easy because the code is still present in WordPress\u2019s files, just not visible in the editor. A quick and easy filter will fix this, and the &#8216;Get Shortlink\u2019 button should be visible:<\/p>\n<pre>add_filter( <span style=\"background-color: #fff0f0;\">'get_shortlink'<\/span>, <span style=\"color: #008800; font-weight: bold;\">function<\/span>( <span style=\"color: #996633;\">$shortlink<\/span> ) {<span style=\"color: #008800; font-weight: bold;\">return<\/span> <span style=\"color: #996633;\">$shortlink<\/span>;} );\r\n<\/pre>\n<h3 style=\"text-align: left;\">Adding it to the theme.<\/h3>\n<p style=\"text-align: left;\">Head over to the WordPress dashboard, and find the &#8216;Theme Editor\u2019 under &#8216;Appearance\u2019. In the &#8216;Edit Themes\u2019 screen that pops up, the list on the right will contain the functions.php file, usually named &#8216;Theme Functions\u2019. Here, at the bottom of this file, you can add on the above code hook. Choose &#8216;Update File\u2019 to finish.<\/p>\n<h3 style=\"text-align: left;\">Checking whether the code works.<\/h3>\n<p style=\"text-align: left;\">If we did everything as described, there should now be a &#8216;Get Shortlink\u2019 button in the Classic Editor view of posts, next to the post name. Clicking on the button will provide you with the shortlink and you can copy it.<\/p>\n<h2 style=\"text-align: left;\">Using a Plugin for Shortlinks<\/h2>\n<p style=\"text-align: left;\">Remember we said that the button would show up in the &#8216;Classic Editor\u2019 view? That\u2019s because it doesn\u2019t show up in the &#8216;Block Editor\u2019 view, and we\u2019ll need a plugin to get that done. Luckily, while there\u2019s more than one plugin that does this, we\u2019ve picked the popular and convenient Pretty Links plugin for our purposes. Here\u2019s how to use it:<\/p>\n<ol>\n<li style=\"text-align: left;\">Installation. On the WordPress dashboard, select &#8216;Plugins\u2019, and choose &#8216;Add New\u2019. Search for &#8216;Pretty Links\u2019, install and activate it.<\/li>\n<li style=\"text-align: left;\">Create the Shortlink.<\/li>\n<\/ol>\n<ul>\n<li style=\"list-style-type: none;\">\n<ul>\n<li style=\"text-align: left;\">Find &#8216;Pretty Links\u2019 on your sidebar, and follow it to its own dashboard, which displays all the shortlinks you\u2019ve created.<\/li>\n<li style=\"text-align: left;\">Choose &#8216;Add New\u2019, enter the original URL, and edit the URL slug for your shortlink \u2013 the slug being the part of the URL that\u2019s right after the domain name.<\/li>\n<li style=\"text-align: left;\">In the &#8216;Advanced\u2019 tab, there are options like setting the link to be &#8216;sponsored\u2019, activating tracking or parameter forwarding, and marking the link &#8216;nofollow\u2019.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p style=\"text-align: left;\">Your new shortlink will be visible in the Pretty Links dashboard, with options, edits possible, and the choice to share it via Twitter and email. Pretty Links Pro adds some features, but you won\u2019t need them if you\u2019re just after shortlinks.<\/p>\n<p style=\"text-align: left;\">And that wraps it up for this overview on Shortlinks for WordPress. We\u2019ll see you next time with more <a href=\"https:\/\/vipestudio.com\/en\/wordpress-blog\/\">WordPress tips<\/a>!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Remember that time when that link you were trying to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":9545,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[113],"tags":[167,173,128,166],"class_list":["post-9544","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-website-wordpress-development","tag-customization","tag-seo-en","tag-wordpress-en","tag-wordpress-search"],"acf":[],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/posts\/9544","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/comments?post=9544"}],"version-history":[{"count":0,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/posts\/9544\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/media\/9545"}],"wp:attachment":[{"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/media?parent=9544"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/categories?post=9544"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vipestudio.com\/en\/wp-json\/wp\/v2\/tags?post=9544"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}