Link to other posts in Wordpress

Aug 14, 2011·
Julio Batista Silva
Julio Batista Silva
· 2 min read
blog Tutorial
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
Authors
Senior Cloud Developer

I’m a Brazilian computer engineer based in Germany, passionate about tech, science, photography, and languages.

I’ve been programming for about two decades already, exploring everything from mobile apps and web development to machine learning. These days I focus on cloud SRE and data engineering.

I volunteer in the open source and Python communities, helping organize PyCon DE and PyData Berlin, mentoring, and contributing with code and translations.

On my blog, I share Linux tips, setup guides, and personal notes I’ve written for future reference. I hope others find them helpful as well. The content is available in multiple languages.

Browse my gallery for some of my photography.

Away from the keyboard, you’ll find me at concerts, playing clarinet, cycling, scuba diving, or exploring new places, cultures, and cuisines.

Always happy to connect! 🙂

comments powered by Disqus