Site icon Hip-Hop Website Design and Development

Maintaining strict one-to-one association between terms and custom posts

I’m building an inventory system where inventory items have their own page but where standard WordPress post post types can also be tagged with these inventory items. As far as I understand, this means I must implement both a custom post type (inventory) to provide each item’s page and a custom, non-hierarchical taxonomy (inventory_item) to represent the relationships between posts in the post post type and pages in the inventory post type. Each custom post type post would be associated with exactly one inventory_item term.

Assuming that the above is the best approach to accomplish this sort of relationship, then this implies that I must handle various edge cases to guarantee the custom-post-to-term relationship is maintained. For example:

Clearly, maintaining this strict one-to-one relationship will require many hooks to handle the various ways in which it can be disrupted. I’d like to hear thoughts about whether this approach seems like the best one to implement what I need, and whether anyone knows of a plugin that implements this already that I could take a look at.