Sort get_users by custom field

By using this you can get your result in ascending order for sort_order custom field $users = get_users( array( ‘meta_key’=> ‘sort_order’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘ASC’ ) ); foreach( $users as $user ) { echo ‘<h4>’ . $user_info-> user_firstname . ‘ ‘ . $user_info-> user_lastname . ‘</h4>’; }

How to change WordPress user ID?

Why not make a new account for this user which will generate a new database ID. Then delete the user with the ID of 1 and attribute all posts / content to the new user you created for them? Then you don’t have to worry about queries or messing up your database. Also, as said … Read more

Set user after wp_create_user?

Here is a function I wrote that hooks into the gravity forms create user form but it can be added to whatever action hook your wp_create_user function is attached to. function my_auto_login( $user_id ) { wp_set_auth_cookie( $user_id, false, is_ssl() ); wp_redirect( admin_url( ‘profile.php’ ) ); exit; } The important part is wp_set_auth_cookie. This has to … Read more

Show Biographical Info while creating new user

No. There are no hooks or filters to add an input field to the create user form. Maybe it is possible to add an input field via jQuery. I have not tested it. If it is pssible to add an input field, than it should be possible to save this information because the process of … Read more

pre_user_query meta_query admin user list

You are using pre_user_query according to WordPress documentation Fires after the WP_User_Query has been parsed, and before the query is executed Then you should use pre_get_users just like pre_get_posts when your arguments have some meaning to WordPress. pre_get_users Fires before the WP_User_Query has been parsed Replace your hook with add_action(‘pre_get_users’, ‘modify_user_list’);