I have given 'Publish' and 'Edit Own' permission to the default WordPress user role 'Subscriber'. I have done this for a custom post type.
After doing this, I am not able to see any users with the subscriber role in the post author dropdown on the custom posts.
Please help.
I escalated this case to our 2nd Tier for further analysis, and I am getting back to you with a workaround solution.
You can add the following custom code to a Toolset snippet and make all the users available in the author dropdown:
add_filter( 'wp_dropdown_users_args', 'add_subscribers_to_dropdown', 10, 2 );
function add_subscribers_to_dropdown( $query_args, $r ) {
$query_args['who'] = '';
return $query_args;
}
The wp_dropdown_users_args hook offers more control, the following code will enable only the subscribers and administrators to be selected in the users dropdown:
function wpdocs_add_subscribers_to_dropdown( $query_args ) {
// Use this array to specify multiple roles to show in dropdown
$query_args['role__in'] = array( 'subscriber', 'administrator' );
// Use this array to specify multiple roles to hide in dropdown
$query_args['role__not_in'] = array( 'editor' );
// Unset the 'who' as this defaults to the 'author' role
unset( $query_args['who'] );
return $query_args;
}
add_filter( 'wp_dropdown_users_args', 'wpdocs_add_subscribers_to_dropdown' );
Please note that this works only for the drop-down in the custom post type list. Check this screenshot hidden link
I'll get back to you as soon as I have something to share.
Thank you for sharing this. Will this option be incorporated in the plugin in the future? removing the need to add custom code?
The request has been escalated to the developers, however, we can't tell when this will be implemented. It may take some months before it lands into Toolset Access.
As of now, the workaround will require custom code. I shared the custom code that should work for the posts list(quick edit), and in the classic editor. You will need a different code to support the Gutenberg editor.
Please check this article for a custom code reference hidden link