Try this plugin Custom Post Type Permalinks, it allows you to set permalinks for custom post types. If your client does not want additional plugin then this plugin is also available on GitHub you can fork it or include this functionality in your own plugin or your functions.php
.
In order to use anything dynamic in the permalink, it has to be a Structure Tag e.g. Custom Taxonomies, Author Name, Date Published, etc.
So you need to have a taxonomy called ‘City’ which you will select while creating the post and then you can use the taxonomy in the Setings->Permalinks
->
%city%/%postname%
Related Posts:
- Changing permalinks gives me 404 errors on nginx
- Strange permalink issue: can’t rename /company-2/ to /company/
- Using $_GET variables in the URL?
- Move WordPress to subdirectory, keep ALL URLs
- ‘post_type_link’ filter not working
- Update URL Snippet to Canonical Permalink URL
- WordPress permalinks Yahoo hosting(no .htaccess allowed)
- How do I turn off 301 redirecting posts (not canonical)?
- How can I include a query string with get_permalink
- Permalink: postname EXCEPT for blog
- %tag% in permalink not working
- Change website URL without breaking links or images? WP 3.3
- How to identifty post from its URL in 404 page?
- Rewrite rule never matching
- How to get blog id from permalink?
- How to edit the slug/permalink in Gutenberg?
- Mass Permalink Changer
- Using WP rather than .htaccess to redirect pages/posts
- How can you receive the most recent permalink or terms of the newly saved post?
- Attachment page 404 not found when image is attached to post
- What happens when permalink settings are updated?
- Change permalink for a single post type only
- How to achieve a clean custom permalink solution?
- How can I make my .htaccess file writeable by wp-admin?
- add new permalink structure from dynamic page
- query_vars in plugin not working?
- echo post-permalink without http and www
- Custom taxonomy rewrite using tax name instead of rewrite slug
- CPT Post Title Permalink: Replace “@” (or all special characters) with dash “-” instead of just removing
- Why is add_rewrite_endpoint incompatible with /%category%/%postname%/ permalink structure?
- Custom permalink for search and pagination
- Rewrite Rule for default post type
- WordPress permalinks that end with a hyphen result in a 404
- Custom query var rewriting with only variable
- Date Archives’ Permalinks under Category folder
- get permalink of page children in loop
- Do WordPress Permalinks Refer to a Lookup Table in the Database?
- Post preview gives 404 when permalinks are purely date based
- Custom $_GET vars in wordpress entry with permalink
- WordPress Not Using Template Files After Permalink Update
- Change Buddypress Admin Profile Page Permalink
- how do links move when I move my site?
- Permalink for PDF of article
- How to link the title adding a permalink?
- Visiting posts results in 404 errors after host migration
- Suddenly new posts have the default permalink instead of the post name
- Comment author url link is wrong? How to change from authors/ to author/
- rename ‘page’ URL fragment in pretty permalinks
- Can’t get permalinks working!
- Why can’t change the permalink of my page/post?
- Redirecting “wrong” but working links to their canonical URL in order to prevent search engine penalties (e.g. /123/ at the end of URLs)
- WordPress not generating .htaccess but tells me that (Permalink structure updated.)
- Direct link to post when multiple categories are selected
- Permalink with anchor on home page to single page
- Getting an ID from a URL, why can WP do this itself, but none of of the functions provided get it right?
- Ignore postname in permalink
- How do I keep multiple domain for my wordpress site
- how to set up wp in folder within static website?
- Create custom links for excerpts with php dynamically
- WordPress permanent links not working (the weird way)
- Permalink Structure not updating .htaccess
- Multiple sites with pretty permalinks with nginx
- mod-rewrite rules grabs “broken permalinks”, too
- How to enable %postname% permalinks on Mac?
- How do I rewrite attachment urls when permalink structure contains %category%?
- Creating an alternate path for a page
- Permalinks causing wp-json to 405
- How to change URL from /%postname%/ to custom-name/%category%/%year%/%monthnum%/%day%/%postname%/
- WordPress Attachment Page URL Rewrite!
- Customize URL for specific tags archive
- Permalink prefix change
- why wordpress keeps redirecting to old page after deleting it?
- WordPress Multisite ABSPATH and get_home_path() to check for htaccess or web.config file
- Every sub page shows Error 404, i have check permalink but still same issues
- Permalink structure /page/page/cpt-post gives 404 with pagination
- Changing permalink structure for Posts
- Allowing slash in slug/permalinks
- Rewrite posts url as they’re all children of a page
- Author permalink
- Multiple Permalink Patterns for one page
- WordPress permalinks first word title
- I can get the permalink or the excerpt to work correctly, but not both
- WordPress permalink issue on AWS
- Permalink for Author’s Posts in a Category
- Permalink Rewrite with Archive – Archive gets 404
- WP Admin Bar not showing with custom permalink structure for pages
- Link to most recent child page
- Automatic -1 suffix being added to the permalinks of a page when the page does not exist
- Why doesn’t WP update my .htaccess file?
- WordPress permalink still not working (error or not understood?)
- Permalink for pages
- How is a URL getting mapped to a page template
- Problem when i configure permalink
- Getting the top level permalink using get_post_ancestors()
- What is the issue with our links? It creates a loop
- Page and post auto links
- Strip category base from URL?
- Does the error “A structure tag is required when using custom permalinks.” mean my permalinks haven’t saved?
- Add additional URL variations for a Post
- How to use ‘blogs.dir’ as media upload instead of ‘uploads’ directory in WordPress multisite setup