Have you ever tried to post a link from your site on a social media like twitter and you notice that the link exceeds the number of characters count? To work around this problem, you may have tried url shortener platforms like bit.ly. But, do you know that you can have a short link of your media, page of your site from directly from your wordpress dashboard? In this case I will show you how to do it.
How to Create Short links in WordPress
Step 1: Write the Short link Code
The code for the Get Shortlink button actually still exists in the WordPress files. It’s just been hidden from the editor. You can restore it using a simple hook:
add_filter( 'get_shortlink', function( $shortlink ) {return $shortlink;} );
This filter will display the Get Shortlink button in the WordPress editor.
Step 2: Add Your Code to the functions.php File
The hook above needs to be added to the functions.php file of your WordPress theme. You can find this by heading to your WordPress dashboard, and clicking on Appearance > Theme Editor.
Step 3: Check to see if Get Shortlink Button is visible
To verify that the button has been added, please edit any page or media on your site.