我认为问题是您传递的是WP\\u User\\u查询对象,而不是查询结果。尝试更改:
$fields = array(
array(
\'id\' => $prefix . \'user_sub\',
\'name\' => \'Subscriber User\',
\'type\' => \'select\',
\'use_ajax\' => false,
\'options\' => $user_query, // this is where you populate the select in metabox
),
);
收件人:
$users_ids = array();
if ( !empty( $user_query->results )){
foreach($user_query->results as $user){
$users_ids[] = $user->ID;
}
}
$fields = array(
array(
\'id\' => $prefix . \'user_sub\',
\'name\' => \'Subscriber User\',
\'type\' => \'select\',
\'use_ajax\' => false,
\'options\' => $users_ids, // this is where you populate the select in metabox
),
);