Site Structure Regarding Custom Post Types and Taxonomies

URL structure and data storage are separate issues. You can use any data in an URL, so let’s ignore that part for now.

Next step: By naming the parts sub and sub sub you went into the wrong direction. Just focus on what the information is, not where it belongs.

Data objects

City should probably a custom type, because you will need custom meta data for that. And I would make that a hierarchical post type, because in large cities it is rather useless to present results from a part of the town that is two or three hours away.

Now look at the relationships between the objects:

  • 1:1 or 1:n (n = many) post meta data; examples: latitude and longitude, average price for a cup of coffee or a bockwurst. 🙂

  • n:m (many to many) taxonomy; each term can apply to many objects, each object can be part of multiple terms; examples: spoken languages, accepted currencies.

  • If an object needs many custom meta data, use a custom post type for that. There is still no term meta in WordPress. You can use the Posts 2 Posts plugin to misuse the post types as pseudo-taxonomies, but this is not trivial.

Permalinks

You can use any data in any permalink. See my plugin T5 Rewrite for an example. You can even use that plugin and create custom child classes to add post meta data or custom taxonomies to any permalink. Examples for regular posts are already included.

Search

By default, WordPress will not search in terms and post meta data. You can change that by filtering the_search_query (example).

Leave a Comment

error code: 523