Set subscriber as author of Blog post in Post Edit mode

Are you looking to select User as a Author of Blog post whose role subscriber or other instead of Admin and without giving any more access of wordpress backend?

wp_dropdown_users_args filter help you to set other role (Subscriber, Contributor etc) users as author of blog post without giving them additional backend privileges.

add_filter( 'wp_dropdown_users_args', 'bind_subscribers_to_dropdown', 10, 2 );
function bind_subscribers_to_dropdown( $query_args, $r ) {
 
    $query_args['who'] = '';
    return $query_args;
 
}

With help of wp_dropdown_users_args filter you also able to bind specific role user as Authors and assign them to Post so it getting display on site as it written by that user even they not have access of wordpress backend or author role.

function bind_subscribers_to_dropdown( $query_args, $r ) {
    $query_args['role'] = array('contributor'); // here you may set multiple role by comma
    // Unset the 'who' as this defaults to the 'author' role
    unset( $query_args['who'] );
    return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'bind_subscribers_to_dropdown', 10, 2 );
Scroll to Top