Alphabet sorting dropdown select

Using Support System plugin on a multisite. The drop-down menu is not alphabetized. How can I change this?

  • Ash
    • WordPress Hacker

    Hello Larry Levenson

    Please try the following code:

    add_filter( 'get_blogs_of_user', function( $sites, $user_id, $all ) {
        usort( $sites, 'ash_cmp' );
        return $sites;
    }, 99, 3 );
    function ash_cmp( $a, $b )
        return strcmp( $a->blogname, $b->blogname );

    You can use this code in your theme's functions.php if the theme is not changed. Otherwise mu-plugin is the best option. To create a mu-plugin, go to wp-content/mu-plugins folder. If there is no mu-plugins folder then, create one. Now, inside the mu-plugins folder create file with name anything.php (make sure file extension is .php). Now start with a <?php tag and then put the above code.

    Hope it helps! Please feel free to ask more questions if you have any.

    Have a nice day!


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.