Custom Taxonomy generator
A ready register_taxonomy, linked to your post type.
Genuinely free. No sign-up, no email, no limits, no cookies. We don't store the URL you analyse.
Code
<?php
add_action( 'init', function () {
register_taxonomy( 'genre', array( 'book' ), array(
'labels' => array(
'name' => 'Genres',
'singular_name' => 'Genre',
),
'hierarchical' => true,
'public' => true,
'show_in_rest' => true,
'show_admin_column' => true,
'rewrite' => array( 'slug' => 'genre' ),
) );
} );What it's for
Taxonomies group content the way categories and tags do. Registering one by hand needs the usual labels and arguments: here you fill them once and get the correct function.
Frequently asked questions
›Hierarchical or not?
Hierarchical = like categories (with parents/children). Non-hierarchical = like tags (a flat list). Choose based on how you want to organise content.