4 Easy Ways to Create and Use WordPress Shortlinks

Besides the keyword-rich content, the title, and the description, your URL also play a crucial role in improving SEO scores and engaging users to click on your content. Too long links drive visitors away, while too short ones are not appealing enough for them to click.

That’s where WordPress shortlink solutions come in handy. You can shorten your page URLs but still make them meaningful. Today’s article will center on the benefits of a WordPress shortlink as well as four methods to create one for your site content.

Why Generating WordPress Shortlink

There are multiple reasons for shortening your WordPress URLs. You can either enhance social shareability or mask affiliate links.

Enhance social shareability

Social platforms like Facebook or Twitter limit the number of characters you can use on each post. If you write a long status, it will hide the major part of your sharing. That’s why you need to cut your URLs to have extra space for more useful content.

Short links also improve user experience and encourage them to share your posts easily. They can send your links to others via emails, Facebook messages, and text messages. This way brings new visitors to your site quickly.

Mask Affiliate Links

Attracting affiliates has become an effective marketing strategy to increase sales. While most affiliate plugins let members customize their links, some others don’t offer this function.

Consequently, your affiliate links will stay endless and contain full tracking parameters. This may discourage users from clicking on your links and purchasing the product.

Improve SEO

WordPress, by default, uses your page/post title as its URL. Your title may include articles and linking words. Still, it’s meaningless to have them in the page address. Instead, you should leave space for targeted keywords.

Here is a default post link generated by WordPress: https://preventdirectaccess.com/4-easy-ways-to-create-wordpress-shortlinks. We can cut some unimportant characters to make it shorter as follows: https://preventdirectaccess.com/4-ways-create-wordpress-shortlinks.

Shortening links makes it easier for you to remove unnecessary words and add multiple relevant keywords in the same link. Plus, you can prevent Google from cutting down the characters on your too-long URL. As a result, visitors can see the entire link and click on it.

#1 How to Create WordPress Shortlinks Manually

It’s possible for you to add a shortlink button to your WordPress classic editor using custom code. There are 2 different paths you can take to achieve this, either entering code to the functions.php file in your child theme or placing the code using the Code Snippets plugin.

We can try both ways so you can pick one depending on your technical skills. First, copy this code:

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

To add it to the functions.php file, you need to go to AppearanceTheme Editor in your dashboard. Now find the functions.php file under Theme Files.


Enter the code above to the file and save your changes. You can open and edit one of your posts to check if the shortlink button has been added there.

If you’re afraid of touching the functions.php file which may affect the site performance, go for the Code Snippets plugin. Below is how to get started with it.

  1. Go to PluginsAdd New in your WordPress admin dashboard
  2. Type ‘code snippets’ in the keyword box
  3. Install and activate the plugin. It now adds a new Snippets section to your admin menu.
  4. Provide the code snippet title and paste the code above
  5. Hit ‘Activate’

That’s it! When you open an existing post or add a new one, you’ll see a short link button next to the page URL.


#2 Shorten WordPress Links with Pretty Links Plugin

Trusted by over 300 thousand websites, Pretty Links appears as one of the most popular solutions to shrink and clean your WordPress links. On top of that, it provides you with a statistic report about clicks on links, the click browser, and geography.


Installing the Pretty Links plugin takes you the same steps as what you’ve done for Code Snippets. Upon activation, you should go to the Add Link page under the Pretty Links section.


Once you enter the page’s link in the Target URL box, the plugin will automatically generate a new shortlink in the Pretty Link box. Click on the icon beside the box to copy the link to the clipboard. Consider writing a description for your link in the Notes section too.

You can use this shortlink on any social platform to share your content with others. The plugin will also track your links and keep all statistics on its Reports page. Still, this function is available in the Pro version only.

There are tons of other free features that are worth your consideration.

  • Generate nofollow or noindex links
  • Send pretty links to users via Email
  • Allow redirects to other URLs such as 301, 302, and 307

#3 Generate Custom Shortlinks for Private Files with PDA Gold

We’re familiar with WordPress shortlinks for pages and posts. Do you know that you can also create some for your media files?

WordPress generates a unique link for each file uploaded to your site. Besides viewing the file on a page, users can open this file via its direct URL by getting the shared link or searching for them on image search engines.

What if these are premium ebooks or files in private forums? You should protect the original file URLs and create short private download links for them. In particular, each user will receive a unique download link which will expire after a given time or a number of clicks.

To start creating short private download links for your WordPress files, you should

  1. Install and activate the PDA Gold plugin
  2. Head to MediaLibrary and find your desired file
  3. Click ‘Protect’ under the file name and go to the ‘Configure file protection’ page
  4. Open the ‘New Download Link’ tab and enter your custom shortlink
  5. Hit ‘Submit’ and you’re done

The ‘Download limit’ option defines the number of times users can click on and download your file. Meanwhile, the ‘Download expiry’ option, tells the number of days your link is available for users to download.

#4 Create Shortlinks for WordPress Password Protected Content

The PPWP Pro plugin offers Quick Access Links (QALs) enabling users to access your password-protected content without having to enter passwords. Each password has a corresponding QAL and they’re all managed in the plugin’s Password Management popup.


Your QALs are random and quite long. Fortunately, you can customize them to make these links shorter. The following guide will show you how to use PPWP Pro to generate short QALs for your private content.

After installing and activating PPWP Pro, you can go to the plugin Settings page and enable the ‘Allow Customizing Quick Access Links’ option.

You can change the /ppwp/ prefix in your URL into anything you want. The default link looks like this: https://passwordprotectwp.com/ppwp/your-custom-slug.

Now head to the page you intend to customize its QALs and open the Password Management popup. In the ‘QAL slug’ column, click the edit button and enter the new shortlink.

Make Use of WordPress Shortlink

WordPress shortlinks give you a great chance to enhance social share, improve SEO scores, and manage affiliate links better.

You have multiple ways to shorten WordPress links, including pages, posts, and media files. If you’re good at coding and development skills, you can add a shortcode to the functions.php file to display a shortlink button in your page URL. In case you’re just WordPress beginners, give the Pretty Links plugin a try.

What’s more, PDA Gold and PPWP Pro turn out to be perfect solutions for private content and media files to generate shortlinks. The PDA Gold plugin helps you create short download links for private files while PPWP Pro assists you in creating short QALs for password-protected content.

You can explore other helpful features of PDA Gold and PPWP Pro in securing your WordPress site content and files here!