Custom post types and taxonomies make managing content easier, but WordPress does not allow full control over their permalinks. WordPress natively cannot let you fully customize them because rewrite rules only support basic URL structures.
Out of the box, each custom post type can have only one rewrite base for all its items. This guide shows how to adjust them using built-in settings without any extra plugins.
If those settings are insufficient and you need more control over custom permalinks, using a plugin like Permalink Manager is the simplest solution.
What are Custom Post Types?
In WordPress, you usually work with two main content types - pages and posts. These come built into the system. Sometimes, your content may not fit well into either one. If this is the case, you may declare a custom content types and separate the content from the standard posts and pages.
There are many situations when this may be useful. Custom post types may handle a variety of content types, including testimonials and events. They are also an essential component of the WooCommerce plugin, which uses them for products.
Do You Really Need a Custom Post Type?
While there are many situations where unique post types can be advantageous, they are not necessarily essential. Consider a few things before using them.
- Blogs
First and foremost, for traditional blog websites, the built-in "post" type is more than enough. Categories and tags are sufficient for most blogging needs. - Simple websites
For websites with just a few static pages like "About Us" and "Contact", there is no point in using extra custom post types. - Content that is alike in structure and form
When you have a lot of similar content items, like "apartments for rent", CPTs make it easier to organize and manage them. A notable example of this is the "products" post type used in WooCommerce for online stores.
Declaring Custom Post Types
There are many methods to define a custom post type. If you do not know much about coding or simply prefer not to deal with code, using a plugin is a the simplest way.
There are lots of freely available plugins, like ACF or Pods, which allow you to register new Custom Post Types (CPTs) and define extra custom fields for them.
The other popular way is to add a code snippet to your website and using the register_post_type() function.
function custom_post_type_registration() {
	 $args = array(
		 'public' => true,
		 'label' => 'Book',
		 'supports' => array('title', 'editor', 'thumbnail'),
		 'rewrite' => array('slug' => 'publication'),
	 );
	 register_post_type('book', $args);
}
add_action('init', 'custom_post_type_registration');
Custom Post Types Permalinks
How Do Rewrite Slugs Affect Permalinks?
The rewrite slug is an optional parameter when registering post types. It sets the default URL pattern for the custom post type items and gives some control over their format.
It is often ignored, but understanding it helps avoid conflicts in rewrite rules that could prevent WordPress from processing URLs as expected.
The rewrite slug is specified as the 'slug' parameter under 'rewrite'. In the example above, it is set to 'publication'. Therefore, the custom post type's permalink structure will be as follows:
https://example.com/publication/post-title

Extra Customization Options
The built-in permalinks in WordPress are limited to basic structures. Using a plugin or a extra code snippet, you can remove default rewrite bases, add category names, or standardize URLs across post types.
For a detailed guide on how to set up and use custom permalinks to organize your site’s URLs, see our full article about custom permalinks.

Leave a Reply