I am creating a custom post for example universities
Now while creating universities I will suppose I will add a University having the name RMIT in that post I will add a custom meta key country AU(Australia)
I want to access this single university's details using URL www.mywebsite.com/au/rmit
and want to get a list of all universities of Australia using RUL www.mywebsite.com/au/
this will list all universities in Australia
So I am adding the country name in the university post as a meta key let me know how can generate this type of URL
because I am not able to generate dynamic URL for post based on meta key values.
au/
in the slug, or trying to insert it from post meta into the URL will be expensive and difficult, but there are far easier ways to get that URL. In future you should ask how to putau
in the URL and mention what you tried, rather than asking how to fix what you tried ( X Y Problem ), we can only answer the question you asked, not the problem you have.au
notus
, I don't see how it would be different. If you want the URL to determine the meta field so it works backwards then that won't work either as you'll be unable to use any caching, and most importantly you'll have different pieces of content for the same post. WP will redirect it to the canonical URL and you'll face SEO penalties, as well as sitemaps that don't make sense