WordPress Permalink is probably the most important thing that you will work with while maintaining your website.
In this tutorial, you will learn everything about WordPress Permalinks, how to tweak them and use them in the most effective way.
So let’s get started with the tutorial.
For other tutorials on WordPress, read these guides:
- How To Make A Website Without Writing A Single Line Of Code
- WordPress Admin Panel – What Is It, How To Log In And Use It Properly
- What is WordPress Theme and How to Work With It?
- Why WordPress Themes and Plugins Are Free? (The Real Reason)
- Categories vs Tags – Which One Should You Use in WordPress?
What is WordPress Permalink?
Permalink stands for Permanent Link. It is also referred to as Pretty Link. Permalink is nothing but the URL of the page.
The Permalink settings in WordPress control the URL structure of posts, categories, and tags.
The URL of this post that you are reading (https://abhijitrawool.com/wordpress-permalink) was also created by setting the Permalink settings.
It is critical that you set the URL structure of your website because each post on your site will be identified by its URL. Changing the URL structure at a later date will make it difficult for your site’s visitors to find your posts if they have the old URLs.
So now you can imagine why setting the Permalink is so critical.
But don’t worry, WordPress makes it very simple to set the Permalinks.
There are many settings available in WordPress to set the Permalinks. You can access these settings from the Permalink Settings page.
Recommended Reading: To understand all WordPress Settings, not just Permalink Settings, read the below tutorial:
Permalink Settings Page Explained
You can get to Permalink Settings page by clicking Permalinks menu item under Settings menu.
On clicking Permalinks in the Settings menu, you will be taken to the Permalink Settings page.
As you can see in the above image, Permalink Settings page has many options using which you can set the URL structure.
Plain permalinks will set the URL in the query string format, like this “http://www.example.com/?p=123”.
It is called query string format because of the part that comes after the question mark “?”. The URL part “?p=123” indicates to WordPress that it has to show the post with ID 123. Each post has its own unique ID.
This URL structure looks ugly, doesn’t it?
That is why this structure is rarely used.
The Day and name permalink structure will include the date on which the post was published followed by the slug of the post, like this “http://www.example.com/2016/07/28/example-post”.
Even this URL structure is not commonly used. The only reason you might want to use this kind of a URL is if you post very frequently and want to arrange your posts based on their dates.
The next structure, Month and name, is the same as the previous structure with the exception that it will not contain the date part. It will only have the month part, like this “http://www.example.com/2016/07/example-post”.
Again, this is not that commonly used structure unless you post very frequently throughout the month and want to arrange your posts by month.
The next permalink structure is Numeric. This structure puts the ID of the post at the very end of the URL, like this “http://www.example.com/archives/123”.
I cannot think of any reason why you should use this structure. No one can remember this kind of a URL.
The next URL structure, Post name, is very commonly used by many people because it makes it so easy to remember the URL.
This permalink structure will add the slug of the post at the end. So if the title of your post is “Example Post” and the slug is “example-post” then the URL will be “http://www.example.com/example-post”.
Beautiful URL, don’t you think?
The only reason you may not want to use this permalink structure is if you expect the same slug to be set for multiple posts or pages of your site.
The next one, Custom Structure, is an interesting one. WordPress allows you to set a custom URL structure. Let me explain this in detail.
How to Create Custom URL Structures in WordPress?
WordPress lets you set a custom URL structure by using Structure Tags.
There are many Structure Tags that WordPress provides by default. You can use these tags individually on in combination to create the desired URL structure.
While building the custom URL structure, you need to keep in mind that you should end the URL structure with either %post_id% tag or %postname% tag. You need to do this so that each URL points to a different post.
Now that you know how to create custom URL structures, here are the various tags that you can use to build the structure:
The year of the post, for example, 2016.
%monthnum% – The month of the year in number format, for example, 07.
%day% – The day of the month, for example, 27.
%hour% – The hour of the day in 24 hours format, for example, 21.
%minute% – The minute of the hour, for example, 24.
%second% – The second of the minute, for example, 45.
%post_id% – The unique ID of the post, for example, 123.
%postname% – The slug of the post, for example, “my-awesome-post”.
%category% – The slug of the category, for example, “my-awesome-category”.
%author% – The username of the author, for example, “admin”.
Other than setting the custom URLs for the posts, WordPress also allows you to set the URL structure of the category and tag pages.
By default, WordPress attaches the “category” and “tag” words in the URL of every category and tag. For example, if you create a category called “My Category” and a tag called “My Tag” then the URLs for the category and tag pages will be as follows:
Category Page URL: http://www.example.com/category/my-category and
Tag Page URL: http://www.example.com/tag/my-tag
Notice the words “category” and “tag” in the above URLs.
You can override these words and replace them with your own words. To do this, you need to set the new names in the “Category base” and “Tag base” fields on Permalink Settings page.
Just set the new names in those fields and click Save Changes button.
If you set the “Category base” field to “new-cat” and “Tag base” field to “new-tag” then the URLs of the category and tag pages will change to:
Category Page URL: http://www.example.com/new-cat/my-category and
Tag Page URL: http://www.example.com/new-tag/my-tag
As you can see, there are various ways in which you can change the URL structure of your site. And because there are so many ways to structure the URLs, a common question that comes up is which structure is best for SEO?
Which Permalink Structure is Best for SEO?
The opinions are divided on this. There are many good articles written on this topic. Just do a Google search and you can find plenty of articles discussing this. Here’s a good one to get you started – 15 SEO Best Practices for Structuring URLs.
I would recommend that you pick one and stick with it. The permalink structures “Post name”, “Month and name” and “Day and name” are all good choices. You can even use “Custom Structure”.
I use “Post name” and never found any issues with using it, neither while building the site nor with SEO.
So pick one and stick with it.
Want to read more about WordPress Permalinks? Here is a great tutorial on WordPress Codex – Using Permalinks.
WordPress provides a lot of options to structure the URLs. So it is essential that you understand all the options and pick the one that suits you.
As they say: With great power comes great responsibility.
So you need to be responsible enough to make proper use of the power that WordPress gives you.
If you learned anything from this tutorial, then please share it with you friends on Twitter and Facebook.