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
- CPT Template Not Showing – Getting 404
- How to remove slug from hierarchical custom types in 3.5.2
- Custom post type yearly/ monthly archive permalinks
- Meta_Query as a way how to setup CPT permalinks – is it a good thing?
- How can I rewrite URLs to pass taxonomy and post type values to the query?
- Custom Post Type, WP_Query and ‘orderby’
- Removing base slug from hierarchical custom post type
- Rewriting ‘rewrite’ slug for custom post type used by plugin
- Adding meta values to permalink
- WordPress custom taxonomy URL rewrite on spelling errors
- How can i avoid the permalink start with ‘blog’ while using the custom post type?
- Custom Posttype Inheritance (and url structure)
- Adding %author% in custom post type URL structure?
- Defining a default page for custom post type
- Pass parameter to custom post type single while keeping clean url
- Including two taxonomies in a permalink structure
- WP Rewrite Rules – Custom post type & taxonomy
- Removing CPT slug from URL results in 404 error for archive page
- Many to Many Taxonomies or rewrite rules?
- Getting Post ID from slug during init
- Rewrite custom post & taxonomy to share same URL path
- how to use two permalinks for one custom post type
- Adding a date archive to Custom Post Type
- Bulk 301 redirect for custom post type
- Trying to manage templates on a blog with lots of custom taxonomies
- Custom Permalink Tag breaks Pagination
- Rewrite numeric ID parameter for hierarchical custom post type
- Customising rewrite rules for CPT single post URL to work as paged URL
- Custom Taxonomy term archive template
- In WordPress how do you create a custom post type with the author’s name in the slug?
- How can I display an archive of only one category of my custom post type?
- Permalink Structure CPT With Custom Taxonomy Fails
- Conditionally custom post type url rewrite
- Plugin for custom posts and fields [closed]
- Bizarre Permalinks Issue: 404 Errors Everywhere
- Making a custom help center page
- wp_insert_term in a multisite installation
- Can’t get custom rewrite tag, query var, permastruct (permalink structure), and rewrite rule to work properly together
- WordPress custom post type permalink rewrite shows page not found
- Customize Custom Post Type URL
- Custom Post Type and Category Base Rewrite Issue
- Rewrite URL of Custom Post Type for Jobs
- non-hierarchical post type with hierarchical url structure
- Custom permalink with child taxonomy terms
- Custom post type archive with page as parent url
- Create Custom Post Type as page
- Pagination custom post type not working with rewrite slug
- After creating Custom post type by user delete old one
- Set parent for custom post type archive rewrite url
- URL Rewrite – Page Archive
- Urls in Custom Post Type work for Terms but not for its Taxonomies
- Custom Post Types and Removing Slugs – should we do it?
- Changing custom post type URL issue
- Taxonomy rewrite pagination 404
- Using custom post types WordPress network
- Custom post types templates
- custom post archive URL is wrong
- WordPress is ignoring my post rewrite rule
- Custom Permalink For Custom Post Type – Working Fine But Broken For Pagination
- Duplicate content problems after adding an archive page to the article’s post type
- Redirect Custom Post Type from Child Taxonomies
- Adding a Section for Visitors
- Custom post type rewrite and wp_pagenavi interfering with each other
- redirect old post type url to new structure url
- Stop Custom post type from being searched via URL
- Remove custom taxonomy ‘post-type’ from post URL
- How can you preserve URLs when moving posts to a custom post type?
- Custom Post Type Base URL
- Custom Post Type and single-posttype template