How to Create Custom Taxonomy in WordPress?

WordPress.jpg
We can easily do this by using the register_taxonomy() function into our functions.php file. Just open your functions.php file. And paste the below code at the end of your file.
add_action( 'init', 'create_events_taxonomy' );

function create_events_taxonomy() {
	register_taxonomy(
		'events',
		'post',
		array(
			'label' => 'Events',             //events are our taxonomy name, you can add yours.
			'hierarchical' => true,
		)
	);
}