Order select dropdown

Support General Order select dropdownResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45873
    netalysnetalys
    Participant

    Hi ! I have a user dropdown field and I've used this filter to return the billing company instead of the username :

    function display_company( $label, $field, $user ) {
    
        $billing_company = get_user_meta($user->ID, 'billing_company', true);
        
        return $billing_company ?? $user->display_name;
    }
    add_filter( 'rwmb_my_field_choice_label', 'display_company', 10, 3 );

    It works perfectly fine, but is it possible to order my select dropdown by company alphabetical order ?

    Thanks !

    #45881
    PeterPeter
    Moderator

    Hello,

    I'm afraid that it isn't possible. You can sort the user by using the setting query_args but not possible to sort the custom label displayed by custom code.

    #45883
    netalysnetalys
    Participant

    Thanks for your quick answer, that was what I was afraid of, but it was a good question anyway 🙂
    Maybe could be a good filter to add 😉

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.