Knowing how WordPress creates it’s own URLs may not be essential to know for general use, but it does give you an edge in understanding how it manages content.

As a starter, note that as a database, all items in WordPress- posts, pages, uploaded media, categories, tags, all are tracked in the database by a unique number identifier, or a database ID. And this is the way it actually determines from a web address what to show you.

For example, the WordPress Page for Week 6 of domain camp pretty much helps you know something about the content from it’s web address, https://extend-domains.ecampusontario.ca/camp/week-6/. But that’s not how WordPress sees the request; it’s actually:

https://extend-domains.ecampusontario.ca/index.php?p=3677

Where 3677 is the database ID for that page.

Because these kinds of URLs are cryptic, WordPress offers tools to make them more human readable. And we can design how they are constructed via the WordPress settings for Permalinks. In your own WordPress site’s dashboard, look under Settings -> Permalinks. Here is where you can choose what structure WordPress can use to make more human URLs for your site. Here is what this interface looks like for the Extend Labs WordPress blog:

WordPress settings options for permalinks

WordPress offers a number of permalink structures that are commonly used; Plain is the actual form that WordPress sees. Most commonly, the structure used has parts to indicate the date when it was published, e.g. this URL from CogDogBlog

http://cogdogblog.com/2009/04/hash-trash-hack-tags/

shows that the post was written in April 2009 and also you can guess it has something to do about hashtags. Other formats in the Permalink settings create URLs that have no indicators of the date, they just use a form based on the post title -it converts all words to lower case, removes punctuation, and replaces all spaces with hyphens.

WordPress creates that link just from your blog post title; the problem is if you write a really long title, you get a long URL. So when the Mad Scientists at Extend Labs write a post titled “That Thing That Happens in the Lab When You Mix The Wrong Elements Together and People are Watching” they could end up with a giant URL if they use a Permalink format that uses the post title to create the URL:

http://thoughts.extendlabs.ca/2018/08/21/that-thing-that-happens-in-the-lab-when-you-mix-the-wrong-elements-together-and-people-are-watching/

If you are aware of that, while editing the post, you will notice you can edit the Permalink it creates by default. The Mad Scientists could manually make it shorter by clicking that Edit button next to the Permalink/

Editing the permalink

and create a more digestable URL, such as

http://thoughts.extendlabs.ca/2018/08/21/that-thing-that-happens/

The Permalink settings allow you to create custom formats, that could, as the scientists did, include a number to represent the year as well as using the post database ID rather than the title text, in the URL. See what they did to make published links like:

http://thoughts.extendlabs.ca/2018/idea/84/

Experiment with your own blog to find a Permalink structure that appeals to you. Save the Permalink settings, then write a blog post that explains your choice, and use its URL as a response to this challenge.

Understanding permalinks will also come into play when you create Categories– this is the “slug” setting you can use to create shorter links for long category names.

Example for "Wrangling WordPress Permalinks":
http://thoughts.extendlabs.ca/2018/idea/84/

Complete This Activity

After you do this activity, please share it so it can appear with other responses below. If your response exists at a public viewable URL, you can add the information directly to this site.

Add A Response

2 Responses Completed for this Activity

  • Playing with Permalinks (Irene Stewart, @IrenequStewart)

    In an earlier camp activity, I changed my permalinks to “post.” For this exercise, I am trying a custom permalink with Year, Month and Post. As you can see in the web link for this submission, it works pretty well. It is still a long link, but I have decided that I don’t mind that… Read more »

  • Permalinks in WordPress (Lisa Koster, @lkoster)

    Here’s the link to my very brief blog post on Permalinks!

Creative Commons License
This work by Alan Levine is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

Leave a Reply

Your email address will not be published. Required fields are marked *