OK so after scratching my head for a day, I decided to rewrite the function. After searching for few minutes, I came across this tutorial that outlined the solution for me. It works like a charm. I hope it helps you guys too.
Related Posts:
- Custom rewrite rules for archive page and single post
- WordPress Rewrite Rules for Custom Post Type and Taxonomy
- Multiple post types – share same ReWrite slug?
- How to modify URL structures in custom post types and taxonomies or terms
- Adding meta values to permalink
- Permalinks so that one custom post type appears to be a child of another, not working
- Permalink rewrite with custom post type and custom taxonomy
- Prepend meta_value to permalink of post
- Permalinks for CPT breaks permalinks to pages
- WP Rewrite Rules – Custom post type & taxonomy
- Remove base slug in CPT & CT, use CT in permalink
- WordPress Rewrite rule for nested post types
- Custom Permalink Tag breaks Pagination
- Custom Permalink for Taxonimie and Custom Post Type
- Permalink Structure CPT With Custom Taxonomy Fails
- Making a custom help center page
- How to change custom post type permalink structure
- How can I use get_post_meta with add_rewrite_rule to build custom permalinks?
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- How can achieve this permalink perfectly? domain.com/%category%/%post-name%
- Customize Custom Post Type URL
- Custom Permalinks with CPT and Hierarchical Taxonomies
- Permalink structure with custom taxonomies and custom post type like /parent-tax/child-tax/custom-post-type-name (with no base name)
- Pretty URLs and custom post types
- Combine multiple CPT names to create valid permalinks
- Set parent for custom post type archive rewrite url
- Route subpage to Custom Post Type
- WordPress custom permalink and archive link for custom post type
- Rewrite URL for CPT to domain/post-name/post-id
- Custom permalink structure for custom post types including multiple taxonomy
- Two CPT: one is using part of the custom rewrite slug from the other
- WordPress custom post type rewrite rule matches all pages returning 404
- Parent cpt/child custom post type URL permalink relationship
- Custom post type permalink structure
- What is the best way to relate different custom post types?
- Mixing custom post type and taxonomy rewrite structures?
- How to rewrite URI of custom post type?
- Custom post types – Use post_id in permalink structure
- Custom post type 404s with rewriting even after resetting permalinks
- Custom post type permalink: only use %post_id% and remove %postname%
- Rewrite rule for Custom post type Monthly and Yearly archive
- Permalink rewrite 404 conflict- WordPress Taxonomies/ CPT
- Rewrite custom post type rss feed links
- Archive page with multiple taxonomies rewrite
- rewrite get parameter with custom post type
- Help with a TV series Rewrite structure
- Taxonomy archives based on Custom Post Type
- Remove unwanted part of permalink custom structure from CPT url?
- Changing a custom post type “has_archive” after registered
- Custom Post Type rewrite redirects to homepage
- Custom Post Type slug same as page name causing a conflict
- Adding paged query to custom URL rewrite
- WordPress rewrite my URL when i use pagination
- Custom Post Type rewrite rules not working, how to alter the rewrite order?
- Customising rewrite rules for CPT single post URL to work as paged URL
- Remove custom post type slug not working for child pages
- Change URL of posts and also Custom Post Type
- Parent & Child Taxonomy slugs in custom post permalink
- Remove url rewrites for registered taxonomies
- Change custom post type slug from plugin options
- 404 Issue w/ Custom Post Type – using Meta for Permalink rewrite
- 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
- How to add rewrite rule to custom post type with parent in url with cpt ui?
- How do I change the custom taxonomy slug to be the same as the custom post type slug?
- Rewrites/query for multiple hierarchical custom post types
- Post Type rewrite rule to point to custom Page/template
- Custom Permalink Structure for Custom Post Type, Custom Taxonomy, Under a page
- How to change permalink to include custom post type
- Custom post type permalink returns 404
- Make custom post types and pages place nice, re: rewrite
- Ignoring slug capitalization on rewrite rule for custom post type archive page
- Add a permalink variable onto custom post type URL after post name slug
- How to query 2 custom post types that need to share a slug?
- Custom Permalinks for Custom Post Types
- Postname on unique permalink structure appends “-2” for a custom post type. How can I get this to stop happening?
- Custom Post Type Advanced Slug
- Pagination for custom post types – url rewriting
- Custom Post Type with modified permalink structure results in 404
- Modifying rewrite rules to use /category//
- Custom Post Type Date Based Archive URL rewrite [duplicate]
- Adding /blog in front of single posts (only)
- multiple URLS for the same page
- 404 error rewrite permalinks
- Is there a way to use ‘publicly_queryable’ => false only on specific taxonomy term?
- Category permalinks don’t work even after flushing
- Custom Post Type parent/child relationship rewrite rules for permalinks
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Custom permalink rewrite rules – how do I fix this?
- Template hierarchy changes when custom post-type permalink leverages custom taxonomy
- Associate custom CPT with another CPT’s taxonomy and rewrite permalinks
- Permalinks for a custom post type – with a page template (custom query) and taxonomy archive
- Post Custom & Taxonomy 404 error
- page not found for example.com/custom-post-name
- Custom post type with parent page? Possible?
- Why won’t this rewrite rule work?
- Adding rewrite rules to Custom Post-type mixed with Taxonomy
- add_rewrite_rule not working with custom post type
- Two Permalinks with one Taxonomy (custom taxonomy) and (custom post type -> custom taxonomy)
- Allow child pages with the same base as the CPT slug