WordPress Custom Post Type Slugs: Best Practices
What Are CPT Slugs and Why Do They Matter?
When you register a Custom Post Type in WordPress, you define a slug — the URL segment that identifies your post type. For example, if your CPT is "Portfolio", the slug might be portfolio, making your URLs look like /portfolio/my-project/.
This slug is one of the most impactful SEO decisions you'll make for a custom post type. Getting it right from the start saves significant refactoring later.
The Anatomy of a CPT Slug
When registering a CPT, the slug is set in the rewrite argument:
``php
register_post_type('portfolio', [
'label' => 'Portfolio',
'rewrite' => [
'slug' => 'work', // This is your CPT slug
'with_front' => false,
],
// ... other args
]);
`
Best Practices
#### 1. Choose Semantic, SEO-Friendly Slugs
Your slug should describe the content, not the technical implementation:
| Bad | Good |
/cpt1/ | /products/ |
/my-portfolio-items/ | /work/ |
/custom-testimonial-post-type/ | /reviews/ |
Keep slugs short (1-2 words), lowercase, and hyphenated.
#### 2. Avoid Conflicting Slugs
Never use a slug that conflicts with:
- Default WordPress pages (/page/
,/category/,/tag/) - Existing pages in your site
- Other CPT slugs from other plugins
#### 3. Use with_front: false When Appropriate
By default, WordPress prepends your "front" base to CPT URLs. If your permalink structure is /blog/%postname%/, your CPT would become /blog/portfolio/my-project/ unless you set with_front => false`.
For most CPTs, you want clean URLs without the blog prefix.
#### 4. Plan for Multilingual Sites
If you plan to go multilingual, choose slugs that translate well. Some slugs work across languages; others need to be localized. Plugins like WPML require slug translations to be set up at the CPT registration level.
Fixing Existing Slugs
If you need to change a CPT slug on a live site, follow this process:
- Update the slug in your plugin or theme code (or use CPTSM Slug Manager)
- Set up 301 redirects from old URLs to new URLs
- Update your sitemap and resubmit to Google Search Console
- Update internal links using a plugin like Better Search Replace
Using CPTSM Slug Manager
Instead of editing PHP directly, CPTSM Slug Manager provides a visual dashboard where you can:
- See all registered CPTs and their current slugs
- Edit slugs without touching code
- Get instant conflict detection warnings
- Preview the URL changes before applying
Conclusion
CPT slugs are a small configuration detail with a big impact on SEO and user experience. Set them up correctly from day one, document your decisions, and use a tool like CPTSM Slug Manager to manage them safely as your site evolves.
More Articles
How to Handle WooCommerce Duplicate Products: A Complete Guide
Duplicate products in WooCommerce are more common than you think — and more damaging. Learn how they happen, how to find them, and how to fix them fast.
Why Duplicate Content Kills Your WordPress SEO (And How to Fix It)
Duplicate content is one of the most underestimated SEO problems in WordPress. Here's the science behind it and the practical steps to fix it.