In addition to specifying names for categories, it may be useful to attach additional information to custom taxonomies created in a WordPress plugin. For example, we may want to assign custom colors to categories that will be used when they are displayed, or we might want to identify the categories of content that are only accessible to paying members on a website.
This recipe shows how to display additional fields in the taxonomy editor and how to store the additional data in the site's database.
You should have already followed the Adding custom categories for custom post types recipe to have a starting point for this recipe, and the resulting plugin should still be active in your development site. Alternatively, you can get the resulting code (Chapter 4/ch4-book-reviews/ch4-book-reviews-v5.php
) from the downloaded code bundle and rename the file ch4-book-reviews.php
.