Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action( 'init', 'my_register_department_taxonomy' );
- /**
- * Registers the 'department' taxonomy for users. This is a taxonomy for the 'user' object type rather than a
- * post being the object type.
- */
- function my_register_department_taxonomy() {
- register_taxonomy(
- 'department',
- 'user',
- array(
- 'public' => true,
- 'labels' => array(
- 'name' => __( 'Departments' ),
- 'singular_name' => __( 'Department' ),
- 'menu_name' => __( 'Departments' ),
- 'search_items' => __( 'Search Departments' ),
- 'popular_items' => __( 'Popular Departments' ),
- 'all_items' => __( 'All Departments' ),
- 'edit_item' => __( 'Edit Department' ),
- 'update_item' => __( 'Update Department' ),
- 'add_new_item' => __( 'Add New Department' ),
- 'new_item_name' => __( 'New Department Name' ),
- 'separate_items_with_commas' => __( 'Separate departments with commas' ),
- 'add_or_remove_items' => __( 'Add or remove departments' ),
- 'choose_from_most_used' => __( 'Choose from the most popular departments' ),
- ),
- 'rewrite' => array(
- 'with_front' => true,
- 'slug' => 'author/department' // Use 'author' (default WP user slug).
- ),
- 'capabilities' => array(
- 'manage_terms' => 'edit_users', // Using 'edit_users' cap to keep this simple.
- 'edit_terms' => 'edit_users',
- 'delete_terms' => 'edit_users',
- 'assign_terms' => 'read',
- ),
- //'update_count_callback' => 'my_update_user_term_count' // Use a custom function to update the count.
- )
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement