I’ve been struggling all morning to solve this and found your question when searching for the answer. I’m sure it’s a little late for you now but in case anyone else stumbles across this question here’s the solution I found:
Change:
$wp_rewrite->add_permastruct('competition', '/au/%prize_category%/%competition%/', false);
To:
$wp_rewrite->add_permastruct( 'competition', '/au/%prize_category%/%competition%/', array( 'walk_dirs' => false ) );
walk_dirs
rewrites the “directories” that make up the URL structure and is set to true by default. Setting it to false ensures the rewrite is only used for the full URL specified.
Related Posts:
- Custom Post Type pages are “not found”
- Remove taxonomy slug from a custom hierarchical taxonomy permalink
- How do I get the permalink of a custom post type?
- remove custom post type permalink
- Shouldn’t this be easy?! Custom post type/custom taxonomy permalink
- WordPress 3.3 custom post type with /%postname%/ permastruct?
- Custom Post type & Taxonomy URL structure
- Combining Multiple Taxonomies in one URL
- Taxonomy term in permalink
- Custom Post Type Archives by Date with Custom Permalink
- Why does a custom post type need the ”hierarchical’ args setting?
- How to modify URL structures in custom post types and taxonomies or terms
- Modify custom post type rewrite rules in a separate function
- Slug for custom post type archive
- Permalink rewrite with custom post type and custom taxonomy
- Make permalinks based on an ACF-field
- Custom permalink with pagination
- Permalinks in Custom Post types
- Custom Post Type with Nested Taxonomy and Template Files
- Semantic URL Custom Post Type and Taxonomies permalinks
- Disable WordPress Recognizing Path as Attachment
- On clicking on the category name the page is redirecting on 404 pge
- WordPress Rewrite rule for nested post types
- Custom Post Type relationship with hierarchical parent and child permalinks
- Passing parameters to WordPress static front page
- Possible for Category Base and Custom post Type to share the same slug/permalink?
- How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?
- Removing parent slug in hierachial custom post type
- Wrong generated page_name/slug on first publish of custom post type
- Stop / prevent WordPress from updating permalinks of custom post type
- How do I correct an incorrect permalink?
- Update permalinks when new category added to custom post type taxonomy
- Tag Archive for Custom-Post-Type Posts yielding 404 when permalinks set to postname
- Does WordPress consider a post name unique if that same post name is in multiple Post Types?
- How to change custom post type permalink structure
- 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
- create a subcatagory for a custom post type and out put url as posttype/subcategory/item
- Show custom post archive when custom post not specified
- Show custom post type relationships by taxonomy
- Completely remove custom post type permalinks (“One Page” website)
- Need help with permalink rewrites for Custom Post Types with hierarchical relationships
- Parent Page and Breadcrumb URL’s for Custom Post Types Not Working
- Permalinks: custom post type -> custom taxonomy -> post
- Custom post type permalink tag 404
- Custom permalinks rules don’t match and lost of query var in the process
- Custom Post Type – Duplicate Page Slugs
- How to Create Template File for Parent Page of Custom Post Type
- Changed permalink structure of CPT – should I redirect?
- How to hyperlink content from archive page with custom post-type
- retrieve permalinks of posts inside custom post type by using post ID
- How to have permalink like domain.com/term/postname?
- Custom post type permalink sends to 404.php
- Post will not load via ajax
- Template for custom post type when taxonomy is in the URL
- Custom Post Type posts, conflict with posts after add_rewrite_rule to top
- How to change base in tag URL for custom post type, to not use “Custom Structure” set in Permalinks setting?
- Combine multiple CPT names to create valid permalinks
- How to add a sub directory to WordPress single posts without affecting other post types?
- How to filter a custom post type by custom taxonomy without 404
- Pagination of custom post type leads to 404 error
- Which is the neatest way to have homepage articles and a blog?
- Custom Post Type nest under a normal WordPress Page
- Custom rewrite rules for /pastissues/%category%-%postname%.html
- Subpages Permalinks Issues
- Multiple permalinks for a single post with multiple taxonomies
- Stop displaying Permalink
- Permalink with hierarchy of Custom Post Types
- Rewrite URL for CPT to domain/post-name/post-id
- Custom Endpoint For Specific Custom Post Type
- How do you create pillar content pages?
- Custom permalink structure for custom post types including multiple taxonomy
- Custom post type single page returning 404 error when sharing archive url with custom taxonomy
- Customise Permalink Structure For Custom Post Types
- How to make “single post” permalink maintain it’s sub-page structure
- Two and more diffrent custom page type in one permalink
- Some permalinks on Apache/localhost development setup return 404’s when set to anything other than plain permalinks
- Page as parent for CPT and other pages
- Two CPT: one is using part of the custom rewrite slug from the other
- Custom permalink with custom taxonomies for custom post type
- Change the url of a custom post type to include taxonomy
- how to use two permalinks for one custom post type based on categories
- Can I override the permalink/slug on creation
- Multiple custom post type and permalink issue
- Custom Post Type with /%shop_name%/gallery/%gallery% permastruct?
- Remove sequential number from permalinks
- Permalinks when using Custom Post Type with static page for archive
- How to change permalinks to taxonomy and post type’s posts
- Have two (permalinks) urls for a same custom post type
- change precedence of permalink for post_types?
- Redirect permalinks after creating custom post types
- Parent cpt/child custom post type URL permalink relationship
- How to make nested custom post type slugs work
- Custom Post Type Permalinks Problem
- Problems with custom post type and hierarchical permalinks
- Custom Post Types and 404 Pages
- Posts picking up old Permalinks, how to reset?
- Remove slug from Custom Category Permalink + dual-category permalinks
- WordPress Set A Static Page/Template For All Sub-Pages
- Get permalink in custom post type loop doesn’t work