Complete the code to register a custom taxonomy called 'genre'.
<?php register_taxonomy('[1]', 'book', array( 'label' => 'Genres', 'hierarchical' => true )); ?>
The first argument to register_taxonomy is the taxonomy name. Here, it should be 'genre' to create a custom taxonomy named 'genre'.
Complete the code to attach the 'genre' taxonomy to the 'book' post type.
<?php register_taxonomy('genre', '[1]', array( 'label' => 'Genres', 'hierarchical' => true )); ?>
The second argument to register_taxonomy is the post type(s) the taxonomy applies to. Here, it should be 'book' to attach 'genre' to the 'book' post type.
Fix the error in the code to make the taxonomy hierarchical.
<?php register_taxonomy('genre', 'book', array( 'label' => 'Genres', 'hierarchical' => [1] )); ?>
The 'hierarchical' argument expects a boolean true or false, not a string. Use true without quotes to make the taxonomy hierarchical.
Fill both blanks to register a non-hierarchical taxonomy called 'topic' for posts.
<?php register_taxonomy('[1]', '[2]', array( 'label' => 'Topics', 'hierarchical' => false )); ?>
The taxonomy name is 'topic' and it is attached to the 'post' post type.
Fill all three blanks to register a custom taxonomy 'skill_level' for a custom post type 'course' with labels and hierarchical true.
<?php register_taxonomy('[1]', '[2]', array( 'label' => '[3]', 'hierarchical' => true )); ?>
The taxonomy name is 'skill_level', attached to 'course' post type, and label is 'Skill Levels'.