Sometimes, an SEO point of view requires to remove custom Taxonomy base from the URL in WordPress.
|Table of Contents|
|1. What We Would Like to Achieve?|
|3. The Most Important Thing That You Have to Do After Code Change|
By default, the inbuilt post has Category & Tags which refer to Taxonomy into the Custom Post Type. Occasionally, We need to create the Custom Post Type with Taxonomy (Category or Tags) to extend the feature of the site.
Now, the site requires to show posts based on Category or Tags (Taxonomy). You have done that but if you look carefully at the URL, there is that Taxonomy (Category or Tags) slug appear which looks ugly in terms of SEO. Now, what to do? In such a case try the following solution.
What We Would Like to Achieve?
Please check this screenshot and ensure that what we are going to do in this article.
Add the below code into your taxonomy registration.
'rewrite' => array( 'slug' => '/', 'with_front' => false )
The Most Important Thing That You Have to Do After Code Change
After you’ve altered your custom post type taxonomy document, try to go to Settings > Permalinks and re-save your settings, else you will get 404 pages not found.
Additionally, read our guide:
- How to Add Products Per Page Dropdown in WooCommerce
- “Sorry, your session has expired. Return to homepage” – WordPress WooCommerce Error
- How to Create a Plugin in WordPress from Scratch
- ERROR: Cookies are blocked or not supported by your browser
- How To Send Custom Emails in WordPress
- How to Allow Preview of Draft Post Without Login in WordPress
- Import Users From CSV In WordPress Programmatically
- How to Redirect Users After Add To Cart In WooCommerce
- How to Remove the Category From URL in WordPress
- How to Add Custom Column To Any Post Types in WordPress
That’s it for now. We hope this article helped you to learn how to remove custom taxonomy base from URL in WordPress.
Please let us know in the comments if everything worked as expected or your issues or any questions. If you think this article saved your time & money, please do comment, share, like & subscribe. Thank you for reading the post. Keep Smiling 🙂 & Keep Coding!