• Hi! I’m currently developing a site which groups various categories of doctors. What i want to achieve is that permalink structure

    site.com/dentist/dentist-province-x/doctor-name-surname
    site.com/dentist/dentist-province-y/doctor-name-surname
    site.com/dentist/dentist-province-z/doctor-name-surname

    site.com/oculist/dentist-province-x/doctor-name-surname
    site.com/oculist/dentist-province-y/doctor-name-surname
    site.com/oculist/dentist-province-z/doctor-name-surname

    and so on.

    Now my question is: do i need to create a custom taxonomy for every single specialist (so dentist, oculist, orthopedic, etc.) or i just need to create a page sepcialist and then put the rest of the pages as children?

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    You don’t need to do anything. 🙂 Organize things in a way that makes sense to you. If the default permalinks are unsuitable, custom permalinks can be defined through add_rewrite_rule(). There is certainly no need for a separate taxonomy for every specialty unless that is what you want to do. They could all be top level terms for a single hierarchical taxonomy.

    I think I see why you’re asking though. The taxonomy name normally should appear in the permalink. You could use a brief tag that’s not too obtrusive, like “md”, resulting in permalinks like example.com/md/dentist/province/name/.

    It’s possible to add rewrite rules without the base “md” to get your desired permalink, but without a base your links run the risk of getting mis-assigned because the only way to identify md (or whatever base) links is by the number of terms. Any other permalink with 3 terms could be assigned to the md taxonomy, resulting in no posts found if the request is not md related. Things are much more reliable when taxonomies have a base.

    So yes, you could work around this by having a taxonomy for each specialty, but that seems cumbersome and inflexible. It’s much harder to add taxonomies than terms. You could add a rewrite rule for every specialty, all being rewritten for the md taxonomy. They become aliases of a sort for the default md taxonomy base. I personally would settle for the “md” base in the links for the ease of adding specialties, but it’s up to you.

Viewing 1 replies (of 1 total)

The topic ‘Custom taxonomy needed?’ is closed to new replies.