The ability to create custom post types and taxonomy is one of the numerous advantages of using WordPress. This will let you arrange your content in a way that makes sense for your website or blog. However, custom post types and taxonomies might create some particular issues when it comes to permalinks.
Because the permalink system in WordPress is limited, each custom post type and taxonomy must have its own permalink structure. As a result, you won't be able to easily change or remove post type & taxonomy slug from WordPress URLs. One of the easiest ways to remove the custom post type and taxonomy slug from WordPress URLs is by using a plugin.
Permalink Manager may be used to not only remove permalink bases, but also to modify them and design whole new permalink structures. It may be used to not only remove permalink bases, but also to add custom taxonomy slugs to custom post type URLs.
What are custom post types and taxonomies in WordPress?
Custom post types allow you to generate new content types that are distinct from WordPress's standard posts and pages. For example, if you operate a restaurant website, you could want to build a custom post type for menu items. This manner, you may provide specific information about each menu item, such as the price, ingredients, and description.
WordPress automatically adds custom post type and taxonomy slugs in URLs. For example, if you have a custom post type named "portfolio", the URL for a single portfolio item may look like this:
Taxonomies, on the other hand, allow you to organize your content into distinct categories. For instance, if you maintain a technology blog, you could want to define a taxonomy for mobile phones, computers, and tablets. This would make it simpler for visitors to track out the specific information they want.
Similarly, if you had a custom taxonomy named "services", the URL for a category will look like this:
Although these URLs do the job, they are not very user-friendly or search engine optimized. Adding redundant slugs in your URLs may make them longer, more difficult to remember, and more problematic for search engines to comprehend.
By removing custom post type and taxonomy slugs from URLs, you may make them shorter, more memorable, and search engine friendly. It can also enhance your website's overall user experience by making your URLs clearer and easier to understand.
How to remove custom post type and taxonomy slugs from WordPress URLs?
Thankfully, you can quickly remove custom post type and taxonomy slugs from your WordPress URLs with Permalink Manager. This section will walk you through the steps to accomplish this and enhance the overall appearance and SEO of your website.
In this section, we have provided simplified examples to help you understand how the functionality works. The different content types managed by WooCommerce are shown here, along with sample permalinks. Each example shows the original URL before Permalink Manager was installed, as well as the desired final pretty permalink.
Our goal is to eliminate the permalink bases (portfolio-item, product and product-category) that are highlighted in red and create user-friendly permalinks.
Portfolio item (custom post type)
Product (WooCommerce post type)
Product category (WooCommerce taxonomy)
Bulk edit the custom permalinks
There are two approaches for obtaining the pretty permalinks. Modifying permalinks in bulk is the most practical and time-saving technique if you don't want to manually adjust individual URL addresses. It should only take a few minutes, and the full procedure may be accomplished in three easy steps.
The first step is to modify the permastructure parameters. You may easily adjust them in the "Tools -> Permalink Manager -> Permastructures" admin area. Each post type and taxonomy can have a different permalink format, as seen below. Simply delete the original bases (highlighted in red) from the input fields to get rid of them.
Pretty permalinks and existing posts and terms
The post type & taxonomy base slug you deleted from the permastructures will no longer appear in the permalinks for new posts and terms. If you wish to apply new customized formats to previously existing WordPress URLs, you must regenerate them using the "Regenerate/reset" tool. You may skip this step if you did not previously add any posts or terms.
Alternative method: Edit the pretty permalinks manually
Manually removing the slugs from each of your unique permalinks is also an option. This approach may take a lot longer than the first, but it gives you more flexibility.