WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a scenario in which the intention is to make custom permalink that can be changed dynamically, for example:

  • If a country information is showing up then the URL should be http://example.com/country-information

  • If the city information of that specific country is showing up then the URL should be like http://example.com/country/city-information.

How can I achieve that?

share|improve this question
Are cities and countries custom post types? – toscho Apr 6 '13 at 8:19
Yeah! They were meant to be custom post types but i had managed to do in another way by doing some URL rewriting. – Adil Abbas Sep 21 '13 at 7:27
Please add your solution as an answer, so other readers can learn something. – toscho Sep 21 '13 at 8:50

It depends on what you mean by "changed dynamically", but the simplest way to achieve what you're talking about is to use pages (or a hierarchical custom post type), and make the "city-information" pages into children of the "country-information" page they are associated with. Then set permalinks to "Post Name", and you'll get the urls you're looking for.

share|improve this answer
By involving some jQuery to avoid "page refresh" every time. Sorry! I was away but I was able to achieve that back then with URL Rewriting, and got that hierarchical order you have said! Thanks for the help btw :) – Adil Abbas Sep 21 '13 at 7:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.