Linking to other posts in Wordpress

Aug 14, 2011·
Julio Batista Silva
Julio Batista Silva
· 2 min read
blog Tutorial
Since I migrated this blog away from Wordpress, I had to change the links to match the new

scheme, but the text is still valid for anyone using Wordpress.

For a long time I used Wordpress as this blog’s CMS. Sometimes I needed to add references to earlier posts, which I did by simply pasting the link shown in the browser — something that turned out to be a problem when I changed domain and changed the way permalinks are generated.

After a quick search I found the solution on this page of 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, take the ID of the post you want to link to and put it in an internal link, as in this example: <a href="index.php?p=434">This Post</a> [This Post](/blog/links-wordpress).

Categories

In the categories panel, take the ID of the category you want to link to and put it in an internal link, as in this example: <a href="/blog/index.php?cat=5">Linux</a> [Linux](/blog/categories/linux/).

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

Pages

In the pages panel, take the ID of the page you want to link to and put it in an internal link, as in this 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-German 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, serving on the PSF D&I Work Group, mentoring, and contributing 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