How to Create a Short Link in WordPress (The Simple Way)

You need to create short links to your WordPress blog posts or pages?

Short links are helpful for sharing in your emails, Facebook messages, and even text messages.

In this tutorial, we will show you how to generate short links using a plugin, and how to add the ‘Get Shortlink’ button back to the classic WordPress editor.

How to Create a Short Link in WordPress

Why Need to Create a Short Link in WordPress?

Sharing your web content on social media can build user engagement and bring new users to your website. But pasting in long links or URLs isn’t always the best way.

That’s because some social media platforms will restrict the number of characters you can use. A shorter URL gives you more space for more informative content, which can lead to more engagement and traffic to your WordPress website.

That’s why URL shortener services like Bitly and TinyURL were originally created. They take a long link and make it shorter so that it doesn’t take up as much space.

In the past, WordPress made it super easy to get a short link to your blog post or page. There was a Get Shortlink button located right next to the permalink area of the classic editor.

Get Shortlink Button in the Classic Editor

However, if you recently started your blog, then you won’t see this feature on your WordPress site because it was deleted after WordPress version 4.4. WordPress still creates the links, but the button has been removed.

Still, there are some ways you can get short links for your WordPress posts and pages.

We’ll cover the best link shortener plugin, plus some ways you can restore the ‘Get Shortlink’ button in the classic editor.

We’ll start with a method that everyone can use. The Pretty Links plugin doesn’t rely on the classic editor and will create its own short link out of any URL.

It works well with all links, including pages outside of your blog or website. So, apart from letting you share your own content, it’s also the ideal tool for shortening affiliate links.

Note: There is a Pro version of Pretty Links with more powerful features like keyword auto-linking and link categories and tags, but for this tutorial, we will only be using the free version.

Once you activate the plugin, a Pretty Links section is added to your WordPress dashboard. To create your first short link, you need to go to the Pretty Links » Add Link page.

Then, you need to paste the original URL of the page you want to share into the Target URL text field. A short Pretty Link is automatically created, but you can customize it if you’d like to make it more readable.

Paste the Original URL Into Target URL

After you’ve created a few short links, you may not remember what they are all for. So it’s a good idea to type in the title of the web page and consider writing some notes of anything you need to remember.

Fill in the Title and Notes

After filling in the Pretty Links form, click the Update button to activate the short link.

Click the Update Button to Activate the Short Link

You will now see a list of all of your Pretty Links. To copy one to the clipboard, just click on the Copy icon at the right of the screen.

Next, you can paste it into any of your social media channels. Pretty Links will even keep track of how many clicks each link gets.

Copy the Short Link Using the Copy Icon

While pretty links have built-in analytics, you can further enhance your analytics by connecting it with Google Analytics using the MonsterInsights plugins.

This is a simple method of adding back the Get Shortlink button to the classic editor.

First, you need to install and activate the Bring Back the Shortlink Button plugin.

Upon activation, this plugin will automatically add the Get Shortlink button to the classic editor. To check that it worked, just edit any of your posts.

The Get Shortlink Button is Added to the Classic Editor

After you click the Get Shortlink button, it will show you the WordPress Shortlink for your post or page. You can copy the link to the clipboard so you can share it with your audience in your emails and messages.

Copy the Short Link to Share It with Your Audience

This method is for more advanced users and uses code rather than a plugin. It adds the Shortlink button to the classic editor by adding a custom code snippet to your theme’s functions.php file.

We don’t recommend this way to inexperienced users because if you make a mistake, then it could break your website. Method 2 above is an easier way to achieve the same result without needing to use code.

We’ll use the Code Snippets plugin, so you’ll need to install that first.

Upon activation, the plugin will add a new menu item labeled Snippets to your WordPress admin bar. Clicking on it will show you a list of all the custom code snippets you have saved on your site.

Continue and click on the Add New button to add your first custom code snippet in WordPress.

Click the Add New Button to Add Your First Custom Code Snippet in WordPress

This will bring you to the ‘Add New Snippet’ page.

You need to start by entering a title for your custom code snippet. Let’s call it ‘Short Link Button’. Once you enter a title, simply copy and paste the code snippet below into the code box.

add_filter( 'get_shortlink', function( $shortlink ) {return $shortlink;} );

Copy and Paste the Code Snippet Into the Code Box

When you see this snippet in the future, you may not remember what it’s for. So it’s a good idea to type something useful in the description as a reminder.

Type Something Helpful in the Description

You can also assign tags to your code snippet. This will help you sort your code snippets by topic and functionality.

Lastly, you need to click on the ‘Save Changes and Activate’ button. Once the snippet is activated, the Shortlink button will be added to the classic editor.

The Shortlink Button Will Be Added

We hope this article has helped you learn how to create a short link in WordPress.

Tags: No tags

Leave A Comment

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