I have created and posted on BitBucket for free access Uni Sortable Users WordPress plugin (ver. 1.0.0). This plugin adds sorting of WP users by dragging and dropping them within the user admin section. It is not entirely my creation. I have found the main idea of how it should work in the Internet, wrapped it and tested it then
And this is how I use it to output sorted users in the front end:
// including of the required file that contains "is_plugin_active" function include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // check if the plugin activated if ( is_plugin_active( 'uni-sortable-users/uni-sortable-users.php' ) ) { $oUserQuery = new WP_User_Query( array('role' => 'instructor', 'meta_key' => 'user_order', 'orderby' => 'meta_value_num', 'order' => 'asc') ); } else { $oUserQuery = new WP_User_Query( array('role' => 'instructor') ); }
You can use your own name of a role or don’t use this argument at all.