If the city and region is always city
and region
strings, you can do something like this.
For your specific case, you could do it like this:
'rewrite' => array( 'slug' => 'city/region/event' ),
'hierarchical' => true,
'has_archive' => false,
'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes'),
If the city becomes some city and the region becomes some region in the URL i.e. city becomes London
and region becomes South East
, you have to use global $wp_rewrite
and write the regular expression to change add the slugs.
You can find more documentation on WordPress Codex – https://codex.wordpress.org/Class_Reference/WP_Rewrite.
Related Posts:
- How to build custom route by adding taxonomies to URL ? ex: www.demo.com/communities/palo-alto/
- Add .html (dot HTML) extension to custom post types
- How to have a custom URL structure for a custom post type?
- WordPress custom post type url change
- remove post-name from title in custom post type
- Multisite with a single, shared custom post type, while retaining site URL
- Rewrite URL for only archive page (custom post type)
- Query var removed after rewrite
- Custom Post type and permalink settings
- Custom Post Types, URL rewrite on multiple CPTs
- Get Taxonomy Term Title by it’s URL
- Front custom edit post page for each post
- Rewrite Question Mark in Post Template to Make it Pretty URL
- Taxonomy in URL
- Custom Post Type Category URL
- How to create custom search result page with custom URL parameters for custom post type?
- Custom post type URL
- Custom Post Type URL Rewrite’s
- returning the currect URL for nested posts
- I want to rewrite the URL of a specific post with a specific custom field to easily analyze in Google Analytics
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- Custom Post – additional param in the custom post URL goes to error page
- Force WordPress to only match URL in category
- Custom post type with parent page? Possible?
- Why is a custom post type’s URL “/?cposts=name-of-the-post” but default post’s URL is “/?p=ID”?
- URL Rewrite Adjustment for Custom Post Type causes template to revert to index.php
- Customize category URL
- Menu Structure and URL structure, with Pages and Post-Type-Posts
- 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
- Rewrite rule taxonomy url with different values in one function
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- multiple URLS for the same page
- 404 error rewrite permalinks
- Rewrite URL for CPT to domain/post-name/post-id
- Custom rewrite rule based on other custom post type title
- Multisite problem with unexisting paths to CSS etc
- How to apply multiple rewrite_rule to a single custom post type url?
- Duplicate content problems after adding an archive page to the article’s post type
- 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?
- Preview url not working outside wp-admin
- How to change URL for custom post type archive?
- How to handle this wordpress custom post type rewrite problem?
- Define multiple prefixes for custom post type
- Custom permalink structure for custom post types including multiple taxonomy
- How can I assign multiple parents to CPT?
- URL for archive of custom post type with 2 taxonomy terms
- i want to change URL of WordPress image or rewrite in runtime
- CPTs relationship
- Subpages URLs for Custom Post Type
- Custom Post type not Querying in switch_to_blog loop
- Query custom post type and custom field by URL parameters
- Display CPT taxonomies as an archive page
- Custom Post Type not using correct page template
- Change CPT permalink to use the category
- CPTUI rewrite disable when no post in CPTUI has been found
- add_rewrite_rule wordpress ignoring url pattern, wp rewrite not working
- How to fix 404 on post after prepending Custom Post Type url with Custom Taxonomy Term slug
- Modify Url for Edit Post Screen in Custom Post Type
- Custom Post Type parent/child relationship rewrite rules for permalinks
- Rewrite of Custom Post Type doesn’t work with dynamic data
- Permalinks: custom post type -> custom taxonomy -> custom sub taxonomy -> post
- Redirect Custom Post Type from Child Taxonomies
- There is how to change url domain on some posts?
- Pretty Permalinks with CTP and Taxonomies / Hierarchical
- add_rewrite_tag broke permalinks that doesn’t use that specific tag
- Rewrite url for custom post type with specific url
- Turning archive templates to a page template maintaining the slug
- Customise Permalink Structure For Custom Post Types
- Adding a Section for Visitors
- Custom post type structure + permalink structure
- Templating advice sub posts of a CTP
- Set archive of custom post type like ‘posts’ page in reading settings is set
- How to use a custom post type as child of a particular post of another CPT?
- How to make “single post” permalink maintain it’s sub-page structure
- Custom Post Type canonical link / pagination redirecting to root
- Rewrite URL of Specific Post of Custom Type
- CPT – Custom Text fields point to new url permalinks
- custom post template not getting picked for posts with Unicode title
- Using get_post_type with a custom URL format?
- Specific template for subcategory of custom taxomy
- How do I control what template is shown based upon Taxonomy Term?
- taxonomy – templates are not loading
- Custom URL for Custom Post Type & Custom Taxonomy Term
- Custom taxanomy and custom post type – pagination leads to 404
- Templates for CPT not working
- Register post type getting error 404
- Flush rewrite rules when new cpt is registred
- How to display a custom post as a page (but unedited)?
- WordPress Custom post type slug rewrite
- WordPress Custom Post Type – Post Attribute: Template. Template shows up and saves on the back end, but the default theme file is being rendered
- Rewrite url post_tag for custom post type
- How to build overlapping custom post_type and taxonomy rewrites without conflicts?
- Single taxonomy for different custom post types
- How to manage a custom post type archive as a page?
- How to manage a custom post type archive as a page?
- Two CPT: one is using part of the custom rewrite slug from the other
- Unwanted URL with Custom Post Type