How to create custom taxonomy in WordPress?

Put Below code in your theme function.php



function people_init() {
    // create a new taxonomy
    register_taxonomy(
        'people',  // Custom Taxonomy name
        'post',  // Custom Post Type Name
        array(
            'label' => __( 'People' ),
            'rewrite' => array( 'slug' => 'person' ),
            'capabilities' => array(
                'assign_terms' => 'edit_guides',
                'edit_terms' => 'publish_guides'
            )
        )
    );
}
add_action( 'init', 'people_init' );