Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

tax-departments

// Register Custom Taxonomy
function tax_departments() {

	$labels = array(
		'name'                       => _x( 'Departments', 'Taxonomy General Name', 'strt' ),
		'singular_name'              => _x( 'Department', 'Taxonomy Singular Name', 'strt' ),
		'menu_name'                  => __( 'Department', 'strt' ),
		'all_items'                  => __( 'All Departments', 'strt' ),
		'parent_item'                => __( 'Parent Item', 'strt' ),
		'parent_item_colon'          => __( 'Parent Item:', 'strt' ),
		'new_item_name'              => __( 'New Item Name', 'strt' ),
		'add_new_item'               => __( 'Add New Item', 'strt' ),
		'edit_item'                  => __( 'Edit Item', 'strt' ),
		'update_item'                => __( 'Update Item', 'strt' ),
		'view_item'                  => __( 'View Item', 'strt' ),
		'separate_items_with_commas' => __( 'Separate items with commas', 'strt' ),
		'add_or_remove_items'        => __( 'Add or remove items', 'strt' ),
		'choose_from_most_used'      => __( 'Choose from the most used', 'strt' ),
		'popular_items'              => __( 'Popular items', 'strt' ),
		'search_items'               => __( 'Search items', 'strt' ),
		'not_found'                  => __( 'Not Found', 'strt' ),
		'no_terms'                   => __( 'No items', 'strt' ),
		'items_list'                 => __( 'Items list', 'strt' ),
		'items_list_navigation'      => __( 'Items list navigation', 'strt' ),
	);
	$rewrite = array(
		'slug'                       => 'afdelingen',
		'with_front'                 => true,
		'hierarchical'               => false,
	);
	$args = array(
		'labels'                     => $labels,
		'hierarchical'               => true,
		'public'                     => true,
		'show_ui'                    => true,
		'show_admin_column'          => true,
		'show_in_nav_menus'          => true,
		'show_tagcloud'              => true,
		'rewrite'                    => $rewrite,
	);
	register_taxonomy( 'departments', array( 'article', ' post' ), $args );

}
add_action( 'init', 'tax_departments', 0 );