WordPress custom taxonomies, explained
Categories and tags are only the start: how custom taxonomies let you organise content your own way.
From the archive: in 2010 I shared “Introducing WordPress 3 Custom Taxonomies” by Envato Tuts+ on my old blog. This page is a short summary in my own words; the original belongs to its author.
For years WordPress had only two ways to group posts: categories (with parent/child levels) and tags (flat). WordPress 3.0 made custom taxonomies a core feature, so you can define your own groupings that fit your content: genres for books, locations for properties, skills for job listings.
add_action( 'init', function () {
register_taxonomy( 'genre', 'book', array(
'label' => 'Genres',
'hierarchical' => true, // like categories; false = like tags
'show_in_rest' => true, // available in the block editor and REST API
) );
} );
Each term then gets its own archive page, which you can style with a taxonomy-genre.php template. Good taxonomies are mostly an information-architecture decision, not a coding one: decide how visitors look for things, and group the content that way.
Read the original: Introducing WordPress 3 Custom Taxonomies, by Envato Tuts+.