Sunday, September 18, 2022
HomeWordPress Developmentwp_dropdown_users_args removes Writer dropdown moderately than limiting the checklist of customers

wp_dropdown_users_args removes Writer dropdown moderately than limiting the checklist of customers


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);

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments