Here is my code for users select option in woocommerce backend. I can not reach dynamic user list in option array.

function woo_add_custom_general_fields() {

    echo '<div class="options_group">';

$users = get_users( array( 'fields' => array( 'ID' ) ) );
foreach($users as $key => $term){
      $options[$term] = $term; 

  woocommerce_wp_select( array( 
      'id' => '_select', 
      'label' => __( 'Custom Select Field', 'boipoka' ), 
      'options' => $options 
    echo '</div>';
add_action( 'woocommerce_product_options_general_product_data','woo_add_custom_general_fields' );

This code is not correct for dynamic users value and options. It show blank option list now

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.