WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been searching for days now without success... Here's my goal: - assign a top level category by user (this I've made it) - let each user create child categories only in his assigned category (this I need to do)

For example: - category-1 > user-1 - category-2 > user-2 SO user-2 can only create sub-category in category-2...

At the end it's like leaving to users the "manage_categories" capability but having it modified so that the user only create categories in its own assigned parent category.

And by the way not seeing the other top level categories on the list categories page (edit-tag.php). Here I'd like to custom the edit-tags.php?taxonomy=category page depending on the user seeing it...

Thanks for your time and advice. David

share|improve this question
up vote 0 down vote accepted

This is how I did it :

function if_restrict_categories($categories) {
  global $current_user;
  $a = get_cat_if_user($current_user->ID);
  $onPostPage = (strpos($_SERVER['PHP_SELF'], 'edit-tags.php'));

  if (is_admin() && $onPostPage && !current_user_can('level_10')) {
  $size = count($categories);
  for ($i = 0; $i < $size; $i++) {
      if($categories[$i]->parent != $a && $categories[$i]->term_id != $a){

   return $categories;
add_filter('get_terms', 'if_restrict_categories');

And where get_cat_if_user() is a custom function where I get the category I've assigned to my user.

Hopes it helps others. Cheers.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.