I wish to solely return customers which have the position of an editor within the ‘Writer’ part underneath ‘Fast Edit’ with wp_dropdown_users_args
. Here is the code I am operating. As a substitute of solely displaying customers with the position of ‘Editor’, it removes the ‘Writer’ dropdown utterly. Am I lacking one thing?
operate author_dropdown($query_args, $r)
{
if (isset($r['name']) && ($r['name'] === 'post_author_override' || $r['name'] === 'post_author')) {
if (isset($query_args['who'])) {
unset($query_args['who']);
}
$query_args['role__in'] = ['editor'];
}
return $query_args;
}
add_filter('wp_dropdown_users_args', 'author_dropdown', 10, 2);