There is a plugin for wordpress which allows you to handle 404 errors and redirect to specific pages. So if wordpress calls your post /events/2013/june/fishing-trip-2
, you could go into the plugin and add a rule so that /events/2013/june/fishing-trip
points to /events/2013/june/fishing-trip-2
.
It’s not a perfect solution, as you’d have to manually enter each duplicate post name to the rewrite rules, and even then the links wordpress generates for that post would still have the -2
. You could write a function using preg_replace to then remove any -2 or -3 or whatever from the end of a link, but it’s a little messy
Related Posts:
- Custom post types, taxonomies, and permalinks
- Permalinks: custom post type -> custom taxonomy -> post
- Mixing custom post type and taxonomy rewrite structures?
- Resolve a custom post type name vs. page permalink conflict (same slug)
- How to rewrite URI of custom post type?
- How to change permalink structure for custom post type and it’s taxonomies?
- Change permalinks for posts but not for custom post types
- How do I append multiple taxonomies to the URL?
- Custom rewrite rules for archive page and single post
- Custom post types – Use post_id in permalink structure
- Rewrite rule for Custom post type Monthly and Yearly archive
- Numeric slug on child post
- Having a custom post slug that clashes with an existing directory
- Help with a TV series Rewrite structure
- post_type_link filter causes 404 on the CPT page it’s used on
- Permalinks in Custom Post types
- Custom Post Type with Nested Taxonomy and Template Files
- Pretty paged permalinks in custom post type loop
- Permalinks for CPT breaks permalinks to pages
- Remove Slug from Custom Post Type results in 404
- Disable WordPress Recognizing Path as Attachment
- single-type.php not working, delivering 404
- How does one flush rules on theme activation or deactivation only?
- Page to display an archive of taxonomies
- How to create a permalink for custom taxonomies and custom post types like base-name/parent-tax/child-tax/custom-post-type-name
- How to show custom taxonomy in the permalink?
- Date-based permalinks for Custom Post Type, and custom taxonomy permalinks
- WordPress rewrite my URL when i use pagination
- Permalinks for custom post-types within custom taxonomies not found
- After updating a page, all pages on the site used the index.php template
- Parent & Child Taxonomy slugs in custom post permalink
- Custom Post Types and independent Categories – complex Taxonomy
- Easy way to change custom post type name for permalinks?
- Use menus with anchors
- Permalink structure by Post Meta value
- custom post type parsed as attachment
- 404 Issue w/ Custom Post Type – using Meta for Permalink rewrite
- WordPress Custom Post Type Permalinks dynamic term slugs
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- custom-taxonomy/post_name instead of the default post_type/post_name
- How to add rewrite rule to custom post type with parent in url with cpt ui?
- Create a custom php page and load it at a specific slug
- Permalinks /country/city/cpt/postname/
- Custom Permalink to remove category word , keeping posts permalink with date?
- Rewrite Rule for showing Parent/Child Relationship between Two Hierarchical Custom Post Types
- Seamless permalinks between Custom Taxonomy and Custom Posts
- Custom post type and custom taxonomy with the same slug using the file page taxonomy only as directory
- Path to custom post type
- How to change permalink to include custom post type
- Make custom post types and pages place nice, re: rewrite
- Custom Post Fields at the beginning of a Custom Permalink
- set permalink for CPT
- Remove custom permalink structure from custom post type without modifying register_post_type() directly
- Permalink problems with custom post type and custom taxonomy
- Route subpage to Custom Post Type
- Custom Post Type “MUST NOT” be able to search via URL
- Custom Post Type Advanced Slug
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Under What Conditions Can I name my CPT the same as my CPT Page?
- Custom post type category permalinks and archive pages
- One Custom Post Type two different Templates
- Adding /blog in front of single posts (only)
- How to remove /blog/ prefix for custom post types in permalinks?
- On saving Post My permalink is updated and category is removed automatically which cause the 404
- Searching in multiple category + URL hierarchy in real estate WordPress site
- Custom post ID & display information related to this ID
- Edit the default ‘post’ custom post type arguments
- add all blog posts to folder
- Category permalinks don’t work even after flushing
- Changing permalink of default Post with custom post
- CPT and rewrite rules
- Custom Taxonomy Archive generates 404
- Enabling hierarchical in a Custom Post Type gives error 404
- Custom post type single with custom URL structure
- Standard Page Child of CPT Not Found (404)
- How to create a permalink structure with custom taxonomies and custom post types
- Permalinks change when edit published post on custom post type
- Custom permalink rewrite rules – how do I fix this?
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- How to retrieve custom post type permalink in another cpt?
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Post Custom & Taxonomy 404 error
- Same permalink structure for all post types?
- the_permalink() leads back to homepage
- Custom post type with parent page? Possible?
- Hierarchical taxonomy in permalink structure
- Can’t make permalink of CPT work
- Issue with permalinks for custom post type
- Cross post type parent page added parent page to permalink but give 404
- Category / Custom Post Type permalink issue
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- “regular” pages not found after changing permalink
- Custom Post Type and Taxonomy pagination permalink
- permalink structure for single-{post-type}.php in wordpress
- Linking from a list of custom post type items to a single – get_post_permalink not working correctly
- Custom post type permalink structure
- How do I use CPT and permalinks with a mobile theme?
- Can I have a specific template for products even if they are standard posts and not CPT?
- Custom Post Type, 404 error
- Have Custom Taxonomy Slug Fall Under Custom Post Type Slug