Is it possible to create a custom url for custom post types?
I have a directory website where in user can post or add a listing in many cities, I have a custom post type name ads. And all of the ads post titles are phone numbers. So when I create a new ads post in a city (e.g. Birmingham AL), the city will be save as a post meta post_ads_city
,
Automatically the url will be mysite.com/ads/123-123-1234
Is it possible to make the url slug based on the city where the ads is posted? so it will be like this:
mysite.com/birmingham-al/123-123-1234 (if the postmeta "post_ads_city" = "Birmingham AL") mysite.com/las-vegas/123-123-1234 (if the postmeta "post_ads_city" = "Las Vegas")
ads
, so it it ismysite.com/ads/birmingham-al/123-123-1234
. with your current desired structure, there's nothing to distinguish those requests from the page post type, all pages will 404. – Milo Dec 17 '14 at 16:32