Tell us what you are trying to do?
Hello, I created a custom post type using Toolset and now want to reassign the post ownership from myself (admin) to some users who are subscribers. I tried everything mentioned in the following thread (see link below), but it won't work:
https://toolset.com/forums/topic/cannot-assign-a-subscriber-as-the-author-of-a-custom-post/
After adding the code, the dropdown menu continues to contain only administrators. There is one subscriber user existing but it won't show in the dropdown.
Is there any documentation that you are following?
https://developer.wordpress.org/reference/hooks/wp_dropdown_users_args/
I have tried adding the following code snippets - non did work for me:
1)
add_filter('wp_dropdown_users_args', 'assign_subscriber_author_func', 10, 2);
function assign_subscriber_author_func($query_args, $r){
$query_arg['who'] = 'subscriber';
return $query_arg;
}
2)
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;
}
3)
function wpdocs_add_subscribers_to_dropdown( $query_args ) {
// Use this array to specify multiple roles to show in dropdown
$query_args['role__in'] = array( 'contributor', 'administrator', 'subscriber' );
// 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' );
What can I do to make this work? Thanks! Ralph
Are you also using Toolset Access to give Subscribers rights to publish posts of that type?
If I recall correctly, because Subscribers are a role with no publication rights, you need to modify the role so that they do have publication rights, but because it is a built-in role, that may not be enough, meaning you additionally need custom code to make it possible.
But as a first step, first confirm that you have modified the Subscriber role to grant publish permissions, using Access.
Dear Nigel, this did the trick!! My issue is resolved now. Thank you so much!