Make the slug translatable when you register the custom post type:
register_post_type(
'post_type_name',
array (
'rewrite' => array (
'slug' => _x( 'post_type_name', 'URL slug', 'your_text_domain' )
)
)
);
Then create a small plugin for the site where you want to change the slug:
add_filter( 'gettext_with_context', 'change_my_slug', 10, 4 );
function change_my_slug( $translation, $text, $context, $domain )
{
if ( 'URL slug' !== $context or 'post_type_name' !== $text or 'your_text_domain' !== $domain )
return $translation;
return 'changed-slug';
}
Related Posts:
- Change slug of registered custom post type in child theme
- Taxonomy page returns 404 page not found
- Prepend meta_value to permalink of post
- Removing CPT slug from URL results in 404 error for archive page
- Getting Post ID from slug during init
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Rewrite rules for custom post type slug
- How to remove slugs from multiple custom post types
- Change custom post type slug from plugin options
- Custom rewrite url category
- Index page with the same id as the slug
- How can I make the slug of the taxonomy also the slug of the custom post
- Programmatically rewriting slug through functions.php but returns 404
- Including taxonomy term before post type breaks top level pages
- WordPress Custom Post Type – Rewrite Query
- Custom Post Type Advanced Slug
- Changing CPT slug and taxonomy already registered in parent theme
- Custom Post Types and Removing Slugs – should we do it?
- Custom rewrite rule based on other custom post type title
- Custom Post Type not using correct page template
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- Two CPT: one is using part of the custom rewrite slug from the other
- Cannot modify a registered custom post type rewrite slug
- Custom Post Type Rewrite Rule
- Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL
- Custom post type Premalinks main page and details page
- Custom slugs with dates & IDs on Custom Post Type
- Add post id to url instead of WordPress default -2 suffix
- Custom post type slug localization
- WordPress uses url different from defined in rewrite arg of custom post type
- Rewrite URL of Custom Post Type for Jobs
- How to prevent a CPT’s slug and page slug from conflicting with each other?
- Custom post Type, child of a Page?
- Custom Post Slug same as Parents Category Slug
- Hide or disallow default custom post type url?
- URL rewriting for CTP assigned entity
- Multiple (two) category postings on the same page.
- Post Type rewrite rule to point to custom Page/template
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Removed custom post type slug but not working for child pages
- Correct procedure for advanced permalinks
- Custom Post Types hierarchy and rewrite
- CPT’s with landing page instead of archive – Url Rewrite?
- How to get list of taxonomy slugs ordered parents>childs?
- Rewrite rule for Custom Post Type Page as a parent
- Added Custom Post Type and the View Option Doesn’t Work
- Rewrite Endpoints and CPTs – How to use in a plugin
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Can slugs from posts and custom post types conflict?
- add_rewrite_rule and passing variables for custom post types
- Pretty URLs and custom post types
- Specific routing for CPT
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Lost of query parameter when using permalink
- Custom Post Type – Duplicate Page Slugs
- Custom post type’s permalink adds the name of the post type before the post name
- Taxonomy in URL
- Custom taxonomy and post type with same slug
- Custom permalink with child taxonomy terms
- Remove permalink for custom post type
- Custom post type archive with page as parent url
- Permalink misbehaving in Custom Post Types
- Auto Slug Generation for Custom Post type
- How to make a posttype show under a page hierarchy (example.com/page/posttype/entry)?
- Best way to specify “article type” in URL
- Custom Post Type archive-{post-type}.php not working
- Custom post type single page (single-{CPT-name}) 404 when slug includes hyphens
- How do you create %post_type%/%postname%/ permalink structure?
- Slug for custom post type
- Pagination custom post type not working with rewrite slug
- Rename a slug label
- Custom Rewrite Rule for Custom Post Type with URL Param
- Slug Confusion Between Post and Custom Post types?
- WordPress custom slug rewrite
- How to find a specific post_type using its “rewrite slug”?
- Different slug taxonomy for two different CPT
- Custom URLs in post types make it impossible to view archive
- How to add current custom taxonomy slug to body class
- Change Slug of a Custom Post Type
- Using page slug in wp_query
- I can’t access custom taxonomy page listing
- How to have permalink like domain.com/term/postname?
- How can Custom Post Type and a page have the same slug?
- How to get postname in custom page?
- Custom Permalinks for Custom Post Types
- Listing all slugs?
- Why WordPress is picking archive.php instead of page.php?
- post_type_link Filter – Too Few Arguments
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Changing slug of all posts
- Share root slug for Child Page and Custom Post Type (prioritizing child pages over posts)
- Custom shortcode works in Elementor editor but not on frontend
- Combine multiple CPT names to create valid permalinks
- WordPress different templates for same type custom post (but different slug)
- why post_class() function apply css classes to all other files?
- After creating Custom post type by user delete old one
- Set parent for custom post type archive rewrite url
- Route subpage to Custom Post Type
- Custom Post Type Category URL