Custom Post Types and Taxonomies
-
After extensive reading, I think I’ve finally got my head wrapped around Custom Post Types and Custom Taxonomies. I’d just like to clear a things up, and have a small discussion regarding them.
First and foremost, if I understand correctly, “Categories” are a hierarchical taxonomy that belongs to the “Post” Custom Post Type (technically not custom, but for the sake of clarification I’ll call it that), and tags are a non-hierarchical taxonomy belonging to “Post” as well, correct? This means the name of the custom taxonomy is “Category” or “Categories” (not sure which, I forget), and that the “terms” within that taxonomy are whatever categories you create.
Given this relationship, if I was to have a website with Lodging as a section (the site covers many other topics), how would I handle the relationship between CPT and taxonomies? I would want a CPT to keep things clean, so I would call that CPT Lodging. I would then want the following taxonomies:
Lodging
-Hotels
-Inns
-Bed And Breakfasts
-ResortsWould naming the custom taxonomy conflict with the CPT name? If so, what’s a best practice to get around that? In my example, Lodging is like “Categories” is to “Posts”, and the 4 types are the created “Categories”. Given this, how would I retain a url structure like so? site.com/lodging/hotels/hotel-name
I’ve been trying really hard as of late to wrap my head around all of this (code included), but I have to make sure I get it before I dive in, or I’ll just make a mess. Does it seem like I understand everything correctly, or am I off? Do you have anything else to add that might help me?
- The topic ‘Custom Post Types and Taxonomies’ is closed to new replies.