I've created a CPT, issue_chapter, and a new user translator. Now how a dropdown can be added with list of translators in this CPT? "Author" and "Translator" both should be there.
I have created a metabox
add_meta_box(
'translator',
'Translator',
'zc_translator_meta_box_callback',
'issue_chapter',
'advanced',
'high' );
function zc_translator_meta_box_callback( $post ) {
$role = 'translator';
$query_users_ids_by_role = array(
'field' => 'id',
'role' => $role
);
$array_of_users_ids = get_users( $query_users_ids_by_role );
$users_ids_list = implode( ',',$array_of_users_ids );
$query_for_dropdown = array(
'include' => $user_ids_list,
);
wp_dropdown_users( $query_for_dropdown );
}
Now how to save the value? Thank you.