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){
unset($categories[$i]);
}
}
}
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.