Are you wondering how to edit permalinks for your custom post types?
By default, you can change the permalink structure of WordPress posts, but not custom post types. However, with the right plugin, you can easily create permalinks for custom posts.
In this article, we will show you how to change custom post type permalinks in WordPress.
Why Change Custom Post Type Permalinks in WordPress?
WordPress uses an SEO-friendly URL structure, which makes your WordPress URLs readable and search engine friendly. These SEO-friendly URLs are called permalinks.
You can customize permalinks by visiting the Settings » Permalinks page in your WordPress dashboard. However, you will notice that you can only change the permalink structure for blog posts.
For example, if you have a custom post type called Movies, then its URL structure will look like this:
Or if your custom post type has archives enabled, then the archive page URL will look like this:
This URL scheme is quite SEO-friendly, and in most cases, you don’t need to change it on your WordPress website. However, you may want to customize it to meet your own needs.
Having said that, let’s see how you can easily customize the custom post type permalink structure in WordPress.
Changing Custom Post Type Permalinks in WordPress
The easiest way to edit custom post type permalinks is by using the Custom Post Type Permalinks plugin. It is a free WordPress plugin that adds more WordPress permalink settings options and allows you to customize them for different post types.
The first thing you need to do is install and activate the Custom Post Type Permalinks plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, you need to visit the Settings » Permalinks page in your WordPress dashboard and scroll down to the ‘Permalink Settings for Custom Post Types’ section.
Here, you can change the permalink structure of specific items in your custom post type.
You can use all the standard WordPress permalink tags. For a complete list of available tags, you can see our article on using an SEO friendly URL structure in WordPress.
Examples of Custom Post Type Permalinks
Let’s assume that you want to use the post ID instead of the post name in the URL. In that case, all you need to do is add this tag:
Notice the trailing slashes at the beginning and end of the tag. These trailing slashes are the separators. Without them, your permalinks will not work.
Don’t forget to click on the ‘Save Changes’ button to store your settings.
Now, the permalinks for a single item in your custom post type will look like this:
The number in the URL will be the numeric ID of the post in your WordPress database.
Let’s take a look at another example. Let’s say that you want to add /year/ before the post name in the URL. In that case, you will use these tags:
Once you are done, simply click on the ‘Save Changes’ button to update your permalinks.
Now, the single item permalink for your custom post type will look like this:
Now, let’s assume that you are using a custom taxonomy called ‘digital marketing’ with your custom post type ‘courses’, and you want to add the custom taxonomy term into the URL.
In that case, you will use these tags:
In this example, ‘digital marketing’ is the slug of the custom taxonomy. The single item permalink for your custom post type will look like this:
We hope this article helped you learn how to easily change custom post type permalinks in WordPress. You may also want to see the most useful tricks tricks for custom post types in WordPress and our expert picks of the best WordPress SEO plugins to optimize your content for search engines.