xxbreadwinner
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: How to Add /blog/ Prefix to Posts, But Not to Custom PostsYou’re running into a common permalink limitation in WordPress. When you add
/blog/to your post permalink structure (e.g./blog/%postname%/), it unfortunately applies to all post types using the'post'rewrite slug — including custom post types, unless handled separately. ✅ Solution:To have only blog posts use
/blog/and keep custom post types clean (like/jobs/,/our-team/), you can do this:- Leave your permalink structure as
/blog/%postname%/ - Manually set the
'rewrite' => ['slug' => 'custom-slug']argument in each custom post type’s registration. This overrides the global/blog/prefix for that post type.
Example (in your theme’s
functions.phpor CPT plugin):phpCopy code
register_post_type('jobs', [ 'labels' => [...], 'public' => true, 'rewrite' => ['slug' => 'jobs'], ... ]);- Flush permalinks after this by visiting Settings > Permalinks and clicking Save.
If you’d like categories to appear like
/blog/category/category-name/, go to:
Settings > Permalinks > Optional and change the Category base toblog/category.
Here are examples from my site that use the proper structure:- <a href=”https://boatengines.store/parsun-outboard-review-2025” target=”_blank” rel=”noopener noreferrer”>Parsun Outboard Review 2025</a>
- <a href=”https://boatengines.store/5hp-outboard-boat-motor” target=”_blank” rel=”noopener noreferrer”>5HP Outboard Motor Buying Guide</a>
- Custom post type (clean URL):
/jobs/example/✅
- Leave your permalink structure as