This should be in a comment, but can’t format much in there.
-
Create a relationship between your CPT and Page. For example, create a custom taxonomy for your CPT and programatically add the pages as terms. Or, you can even create a meta field.
-
Create a placeholder for the URL while registering the CPT. For example
'rewrite' => array( 'slug' => '%cpttag%'),
. -
str_replace
the placeholder with page slug you get from term/meta usingpost_type_link
. -
Flush the permalinks (Just hitting Save on Permalinks Settings page will do it)
Related Posts:
- Multiple post types – share same ReWrite slug?
- WordPress custom taxonomy URL rewrite on spelling errors
- Interesting Custom Post Type Slug with Taxonomy and Custom Field
- Change custom post type slugs, with category/taxonomy before post type name
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- YOAST SEO won’t work on custom post type archive [closed]
- Custom Post Types and Removing Slugs – should we do it?
- How can I assign multiple parents to CPT?
- Cannot modify a registered custom post type rewrite slug
- How to rewrite URI of custom post type?
- Custom post types – Use post_id in permalink structure
- Custom Post Type and Taxonomy URL rewrite
- Custom post type permalink: only use %post_id% and remove %postname%
- Rewrite custom post type rss feed links
- Archive page with multiple taxonomies rewrite
- rewrite get parameter with custom post type
- WP 3.1 – archive pages for custom content types possible now without a plugin?
- Admin Post Update Redirection to Posts Screen
- modify all posts of a category to “no comments allowed”
- Remove unwanted part of permalink custom structure from CPT url?
- How to not allow custom roles to edit published custom post types?
- Assign Page Template Within A Custom Post Type
- How to have a custom URL structure for a custom post type?
- Changing a custom post type “has_archive” after registered
- [Plugin: Posts 2 Posts] Changing display order of connections
- Disable dragging of metaboxes in custom post types?
- Custom Post Type rewrite redirects to homepage
- Error after deleting Custom Post Type with a function (no trash used)
- Custom Post Type slug same as page name causing a conflict
- Adding paged query to custom URL rewrite
- Structure for projects and clients
- Custom Post Type rewrite rules not working, how to alter the rewrite order?
- Rewrite Custom Post Type URL slug
- Customising rewrite rules for CPT single post URL to work as paged URL
- Why is my custom loop not filtering correctly nor paginating?
- Custom post types with custom directories
- Saving repeated option values in a custom query
- Remove custom post type slug not working for child pages
- Custom WP TItle from custom template with dynamic URL structure
- Rewrite rules for custom post type slug
- How to customize admin posts based on the user who is logged in
- Custom Post Type | Fatal Error on register_post_type()
- apply filters only to specific post listing without check the url parameters
- Dynamically add / duplicate custom meta in custom post types
- Custom Post Type rewrite
- How can I create a custom meta box to add an mp4 video to a page?
- Custom post type menu missing after 3.0b2 -> 3.1.2 upgrade
- Group posts by custom post type
- Remove url rewrites for registered taxonomies
- Plugin: register custom post types, child ready and performance best practices
- Define new user capability for custom post types?
- Get Taxonomy Term Title by it’s URL
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- Using taxonomy term in CPT permalink – Pages 404’s
- Programmatically rewriting slug through functions.php but returns 404
- How to handle paged param in post and custom-post-type?
- Why isn’t my custom post type archive URL translating?
- Shortcode to display Staff post type based on Location post type and Specialty post type
- Post Type rewrite rule to point to custom Page/template
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- How to add attributes to taxonomies that may be different from post to post?
- Taxonomy in URL
- How does order=asc effect a wp_query (its acting pretty weird in a loop)
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- How Can I Remove Custom Post Type Slug From URL
- WordPress custom permalink and archive link for custom post type
- WordPress Count posts within a custom post type
- get_post_permalink() and custom permalink rewriting
- Need to have an archive widget which organizes and displays a custom post type using a custom date field
- Taxonomy rewrite pagination 404
- Custom Content Type with No Page View
- Custom post type tags not showing in search
- How to list posts by term (custom taxonomy)
- Custom Post Type Implementation
- Related “custom post type” using “custom taxonomy”
- How do I disable the built-in editor and automatically configure the properties of new pages?
- multiple URLS for the same page
- How can i display a taxonomy? i have created a plugin and then a custom type. and a taxonomy , also i have register it
- Define multiple prefixes for custom post type
- Is it possible to create 2 unique titles for an Events custom post type: Upcoming Events and Past Events?
- wp delete duplicate entries of custom post types every 15 minutes
- Attempting to create custom “post” template, getting a 500 internal server error
- connect users to Custom post types
- Custom user roles
- One Post with different content, depending on a Page
- Remove custom post type slug but keep related category taxonomy permalink
- page not found for example.com/custom-post-name
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Custom Post Type
- Registering an optional custom post type from a plugin
- Custom post type with parent page? Possible?
- Why won’t this rewrite rule work?
- Custom metabox value not saving
- Select Menu for Custom post Type does not save
- Generating custom URL before post is published
- Inserting two categories
- How to delete unnecessary custom post types in the UI
- How can i change url structure of cpt like this?
- Advise on Custom Taxonomies and Structure
- Menu Structure and URL structure, with Pages and Post-Type-Posts