Link to other posts in Wordpress

Note: As I migrated this blog from Wordpress, I had to change the links to reflect the new template, but the text is still valid for those using Wordpress.

For a long time, I used Wordpress as the CMS for this blog. Sometimes I needed to add references to previous posts, which I did simply by pasting the link displayed in the browser, which became problematic when I changed domains and altered the way permalinks are generated.

After a quick search, I found the solution in this page in the Wordpress documentation, which also explains how to link pages and categories.

I also found a plugin that makes this task easier: http://wordpress.org/extend/plugins/link-to-post/

Posts

In the posts panel, get the ID of the post to be linked and insert it into an internal link, like in the example: <a href="index.php?p=434">This Post</a> [This Post](/blog/links-wordpress).

Categories

In the categories panel, get the ID of the category to be linked and insert it into an internal link, like in the example: <a href="/blog/index.php?cat=5">Linux</a> [Linux](/blog/categories/linux/).

For some reason, the category is behaving differently when I am on a page other than the home page, so I used an “absolute path”. I will have problems if I change the name or path of the Wordpress folder (/blog now).

Pages

In the pages panel, get the ID of the page to be linked and insert it into an internal link, like in the example: <a href="index.php?page_id=319">About the blog</a> [About the blog](/about).

Julio Batista Silva
Julio Batista Silva
Data Engineer

I’m a computer engineer passionate about science, technology, photography, and languages. Currently working as a Data Engineer in Germany.

comments powered by Disqus