Repository navigation
Custom User Taxonomies
John James Jacoby edited this page Sep 10, 2026
·
1 revision
Create a WP_User_Taxonomy during init to add another classification:
add_action( 'init', function() {
new WP_User_Taxonomy(
'department',
'users/department',
array(
'singular' => 'Department',
'plural' => 'Departments',
'managed' => true,
'exclusive' => true,
)
);
} );The constructor accepts:
- Taxonomy name, such as
department. - Rewrite slug, such as
users/department. - Taxonomy arguments. In addition to WordPress taxonomy arguments, the plugin
recognizes
singular,plural,managed,exclusive, anduser_group. - Optional label overrides.
- Optional capability overrides.
-
user_groupidentifies the taxonomy towp_get_user_groups(); defaults totrueforWP_User_Taxonomyinstances. -
exclusivechanges the assignment interface from multiple selection to a single selection. -
managedrestricts assignment by ordinary users while retaining administrator management. -
show_uicontrols the administration UI and Users column. -
hierarchicaldefaults totrue. -
publicdefaults tofalse.
Remove its registration callback before the default priority, then register your replacement:
add_action( 'init', function() {
remove_action( 'init', 'wp_register_default_user_type_taxonomy' );
}, 0 );The equivalent Groups callback is
wp_register_default_user_group_taxonomy.
Put durable customizations in a small functionality plugin rather than a theme, so changing themes does not remove the taxonomy registration.
User taxonomies attach to the user object type by default. The
wp_user_groups_taxonomy_objects filter can change that array, but mixing object
types is risky because IDs from different object tables can collide.
Documentation for WP User Groups · Support