I'm trying to change the author of CPTs. WP only let me choose between 'admin', 'editor' and 'author' but i need to see all users.
The arg [who] is deprecated due an WP update and dosen't work anymore. a rollback is no option for the site.
I used the following snippet in functions.php :
------------------------------------------------------------------------------------------------------------------------
// Show all users in 'author' drop down on editor
add_filter( 'wp_dropdown_users_args', function( $query_args, $r ) {
$query_args['who'] = '';
return $query_args;
}, 10, 2 );
------------------------------------------------------------------------------------------------------------------------
I also tried an other as you can see in the following snippet but it also won't work:
------------------------------------------------------------------------------------------------------------------------
function show_all_users_dropdown( $query_args, $r) {
$query_args['role__in'] = ['supplier'];
return $query_args;
}
add_filter('wp_dropdown_users_args', 'show_all_users_dropdown', 10, 2);
------------------------------------------------------------------------------------------------------------------------
And i also tried this one below:
------------------------------------------------------------------------------------------------------------------------
function func_author_dropdown_user_args( $query_args ) {
// Use this array to specify multiple roles to show in dropdown
$query_args['role__in'] = array('administrator' );
// Unset the 'who' as this defaults to the 'author' role
unset( $query_args['who'] );
I want to choose between all users no matter wich role the user has. Or to add the users with the custom role 'supplier' to the dropdown.
Thank you for your assistance.