This is far from trivial. URL processing is not straightforward and mostly buried in WP->parse_request()
which is not popular to reuse.
There is more useful url_to_postid()
function, but it’s limited to posts and does not process URL to other things.
If really necessary this would take fork of that function to deal with terms. However more practical solution would probably be to pass some extra data in some form and don’t mess with URL at all.
Related Posts:
- Custom Post Types, URL rewrite on multiple CPTs
- Taxonomy in URL
- Custom Post Type URL Rewrite’s
- Force WordPress to only match URL in category
- Customize category URL
- Custom Post Type with multiple Custom Taxonomies / Hide Taxonomy Slug from URL
- Custom post type with custom taxonomies structure url not working archive of CPT
- How Can I Change the Custom Post Type Slug to the Taxonomy Slug in the URL?
- Use same slug base for Custom Post Type posts, and multiple taxonomy terms
- How to create custom url structure based on custom post type rewrite slug, taxonomy and category slug?
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Rewrite Question Mark in Post Template to Make it Pretty URL
- How can I make the slug of the taxonomy also the slug of the custom post
- Customize Custom Post Type URL
- How to rewrite url for any specific taxonomy?
- Custom post URL 404 error
- How do I change the custom taxonomy slug to be the same as the custom post type slug?
- Custom taxonomy rewrite with query var returns %2F in URL
- WP Rewrite Rule Issue while using Custom post type & taxonomy
- Remove slug in URL custom post type
- Custom Permalinks with CPT and Hierarchical Taxonomies
- WordPress uses url different from defined in rewrite arg of custom post type
- URL rewriting for CTP assigned entity
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- Custom taxonomy returns 404
- Including taxonomy term before post type breaks top level pages
- Correct procedure for advanced permalinks
- CPT’s with landing page instead of archive – Url Rewrite?
- How to get list of taxonomy slugs ordered parents>childs?
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Custom taxonomy and post type with same slug
- Custom permalink with child taxonomy terms
- Best way to specify “article type” in URL
- Custom URLs in post types make it impossible to view archive
- I can’t access custom taxonomy page listing
- post_type_link Filter – Too Few Arguments
- Custom Post Type Category URL
- Add term slug in URL of custom post type details page
- Custom Post Type Advanced Slug
- How to rewrite custom taxonomy term archive to use THE SAME SLUG/front as CPT
- How to create custom search result page with custom URL parameters for custom post type?
- WordPress custom permalink and archive link for custom post type
- How to rewrite the post slug of a custom post type post
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- Custom post type URL
- Modifying rewrite rules to use /category//
- Custom Post Type View Button in Admin Gives 400 Error
- Taxonomy rewrite pagination 404
- Archive page for custom post type and custom taxonomy
- custom post archive URL is wrong
- Custom taxonomy and post type rewrite rules
- Custom Post Type and Taxonomy Rewrite Error
- returning the currect URL for nested posts
- Custom taxonomy terms as children of multiple custom post types
- Remove cpt slug from url and use custom taxonomy instead breaks all other cpt
- how to achieve this permalink abc.com/CPTName/CustomPostTypeCategorySlug/categoryname
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Custom Post Type & Taxonomies – Rewrite
- Remove custom permalink base from CPT custom category and custom tags
- How to properly set the rewrite rules for this case?
- How to handle this wordpress custom post type rewrite problem?
- Define multiple prefixes for custom post type
- URL for archive of custom post type with 2 taxonomy terms
- Display CPT taxonomies as an archive page
- Change CPT permalink to use the category
- How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Redirect Custom Post Type from Child Taxonomies
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- Customise Permalink Structure For Custom Post Types
- Custom post type structure + permalink structure
- Custom URL for Custom Post Type & Custom Taxonomy Term
- Custom taxanomy and custom post type – pagination leads to 404
- Register post type getting error 404
- Flush rewrite rules when new cpt is registred
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- What am I doing wrong with my taxonomy?
- I have a custom taxonomy assigned to two post types. How do I create URLs for different term archives for each post type?
- CPT url rewriting : regular posts return 404 error
- Custom Post Type rewrite url to /category/pagetitle [duplicate]
- Remove custom post type slug but keep related category taxonomy permalink
- page not found for example.com/custom-post-name
- Custom post type with parent page? Possible?
- redirect old post type url to new structure url
- One custom post type with two different url structure base on taxonomy term
- Why is a custom post type’s URL “/?cposts=name-of-the-post” but default post’s URL is “/?p=ID”?
- Why won’t this rewrite rule work?
- Parent cpt/child custom post type URL permalink relationship
- Remove custom taxonomy ‘post-type’ from post URL
- Sorting custom post types by taxonomy (So close)
- Custom post type and custom taxonomy archive inaccessible
- Custom Post Type Base URL
- Custom Taxonomy in Permalink from post type
- Tags and Taxonomy links not working for Custom Post Types
- How can i change url structure of cpt like this?
- How to change custom post type slug without damage seo? [closed]
- Links in archive not including taxonomy parameter
- Rewrite Rule for custom post type link with or without taxonomy terms