WP SITES

2948 Tutorials & 189 Plugins

Using Short Codes For Internal Linking To Prevent Broken Links

CF Internal Link Shortcode is a plugin which uses short codes to link your internal pages rather than url’s. This way your links will never become broken if the url to the linking page or post changes.

Link Shortcodes

Here’s the difference between using a short code and standard url when linking internally:

  • <a title=”URL Sample” href=”http://www.yourdomain.com/” target=”_blank”>Sample Page</a>
  • <a title=”Short Code Sample” href=”[link id=’2′]” target=”_blank”>Short Code Sample</a>
url versus shortcode

Using Short Codes for Internal Links

After you install and activate the plugin, you find a search box module has been added to your Edit Post & Edit Page screen.

Internal Link Shortcode

Type the title of the post or page you want to link to into the Internal Link Short Code Look Up search box and posts/pages whose title matches your search will be displayed.

Internal Link Shortcode Lookup

All you need to do then is copy the short code and paste it into the box where you would normally insert the internal link url.

Insert Shortcode Link

The shortcode which links to a page or post looks like this:

[link id=’100′]

Manually Inserting The Shortcode

If you can’t find the shortcode using the search box, read more about how to find post & page I.D’s.

After you have located the i’d of the page you want to link to, insert the number between the ‘#’ within the shortcode and the entire shortcode in your HTML editor where you want the link displayed.

This will link to the post or page with the id you have entered.

Changing Post or Pages URL’s

If you change the permalink of any pages or posts which are using a short code instead of a standard url, you won’t need to fix broken links which would normally be the case. Your links will now change automatically to the name of a post or page which you moved.

Negatives

  1. Can take longer to find the shortcode to the linking page as the search box doesn’t always work that well
  2. Will take longer if you need to find the linking page/post i.d’s manually

Positives

  1. Don’t have to worry about broken links when you change post/page Permalinks.

What do you think about using a plugin like this? Do you see any great advantages?

Newer Solutions

Was This Tutorial Helpful?