Permalink structure for blog posts and pages are managed in WordPress Settings -> Permalinks
page, so to make blog posts have permalinks like blog/%postname%/
and you’ve done it right.
The tricky part is about Custom Post type permalinks declaration:
in your CPT arguments declaration there’s a rewrite
rule parameters, which in turn has with_front
– if this parameter is false
you’ll have permalink structure without prefix used for blog posts, and if it’s true
you’ll have what you’ve experienced. By default it’s set to true
.
So fixed part of rewrite parameter will look like.
'rewrite' => array(
'slug' => 'casestudies', // your case studies permalink base.
'with_front' => false, // important to make your links without base of blog posts.
'pages' => true, // set true if you need pagination for your cpt listing.
),
Related Posts:
- How to remove dates from existing permalinks?
- Getting the Site URL Including the Front Base
- Pretty Permalinks
- Force wordpress to display page with same url structure as categories
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- Is it possible to change the permalink structure without changing the old permalinks to posts and without 301 redirects?
- 301 redirects after changing permalinks
- My permalinks for all pages and posts now include old page titles as parents/categories
- How to change URL of my pages?
- permalinks url with woocommerce
- Need help with add_rewrite_rule
- remove “index.php” from permalinks
- How do I add /blog/ as a prefix to permalink structure for blog posts, tag pages, etc.?
- Passing and retrieving query vars in wordpress
- Permalink format: singular or plural
- How does WordPress handle permalinks?
- Pretty permalinks for search results with extra query var
- How to get pretty URLs with add_query_arg in permalinks
- What is the best permalink structure for SEO?
- Creating custom permalink structure for languages
- Custom post type permalink endpoint
- Using $_GET variables in the URL?
- Including category-base in a post permalink results in 404
- WordPress thinks my custom route is a 404
- Filtering categories in the permalink structure
- Minimal custom permalink structure
- Date based URLs for custom posts and pagination
- How to add a custom URL placeholder to author archives?
- Multiple post categories – single permalink
- How to custom change author base without $this->front?
- URL rewrite based on a custom field value
- Update URL Snippet to Canonical Permalink URL
- How to prevent the default home rewrite to a static page
- How do I turn off 301 redirecting posts (not canonical)?
- “.#[random-char-string]” being inserted at end of URLs
- How to change author base without front
- permastruct for custom post type not working in one of four cases
- URL Rewrite + Page + Custom Post Type = Unusual Redirect
- Make post slug have priority over category slug
- Remove parent slug for child pages
- How to create a permalink structure for posts in a specific category
- How to remove the index.php in the url?
- How to map permalinks with accented letters to sanitized slugs?
- Remove subfolders from URL
- Remove parent slug for child pages
- Add custom directory in URL
- Using two permalinks for one post
- flexible rewrite ‘ramble’ URLs with WordPress
- How can I Rewrite a ‘page’ URL based on query string parameters?
- Custom rewrite rules for a $_GET request
- Nice RSS Feed URLs for each custom post type
- Pros and cons of using [taxonomy name] in place of [category name]?
- Change the custom post type permalink
- Custom rewrite rules for feeds of custom queries (query_var query strings in URL)?
- custom naming of search permalink /search/
- Auto 301 to full post permalink? (using /posts/%post_id%/%postname%)
- How to get rid of index.php?
- Put post ID on the custom post type URL
- Rewrite url / permalink for default archive – yearly / monthly
- Does a parent page’s post_title have to appear in a child page permalink?
- Rewrite user profile URL to be human friendly
- Random Alphanumeric Key URLs
- Permalinks, Rewrites, Get Variables, Oh My!
- Using WP rather than .htaccess to redirect pages/posts
- Change permalink for a single post entry
- Remove the Parent category from the permalink but leave the child category
- How to Modify Existing Rewrite Rules?
- Rewrite URL for results of a custom WP_Query
- Rewrite URL Parameter And Force ‘Pretty’ Permalink
- Using ‘Primary Category’ in URL
- rewrite_rule for custom post type doesn’t affect get_permalink
- Add ‘articles’ prefix before blog posts url without affecting pagination
- Apostrophe in permalink results in page not found
- Image Attachment Url Rewrite
- custom permalink/shortlink with base62 encoded post ID
- Change permalinks with ACF values
- template_include not loading -instead goes to index.php
- Rewrite Page with a slug before page name
- Getting links to work the same on development and production
- Can’t get rewrite rules working
- Multilanguage URLs
- Rewrite my default post URL
- Incorrect 404 for pages when using permalink, a static front page, and posts page
- add new permalink structure from dynamic page
- When is it a good idea to build a permalink structure from scratch?
- WordPress not respecting template hierarchy (fetches index.php instead of single.php or page.php)
- How to improve WordPress security by hiding non public facing files?
- If the only permalink setting is %postname% what happens in the case of old duplicates?
- Call to a member function add_rule() on a non-object
- Custom taxonomy rewrite using tax name instead of rewrite slug
- I need a custom permalink for my website
- Change author slug and functionality
- How to reset canonical URLs / fix redirect loop
- Why does chrome keep downloading a file instead of running the site?
- How can I add a page’s ID to its permalink using WP_Rewrite?
- Attachment Page Permalink/URL Rewrite Issue. How to change the actual rewriting?
- Permalinks: Page Not Found
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Re-write specific custom post type category URL to go to another page
- If I change permalink structures, can I use htaccess to permanantly redirect links?