How do I update user email from frontend input field?

You can diagnose error while updating user email. $user_data = wp_update_user( array( ‘ID’ => $user_id, ‘user_email’ => $email ) ); if ( is_wp_error( $user_data ) ) { // There was an error; possibly this user doesn’t exist. echo ‘Error.’; } else { // Success! echo ‘User profile updated.’; } Might it can help you.

Allow a user or role to view drafts and previews, but not other admin privileges?

Figured out an easier way. I gave them the edit_other_posts and edit_other_pages role capabilities, and then blocked their access to the admin area using the following: add_action( ‘init’, ‘eri_block_nonadmins_init’ ); function eri_block_nonadmins_init() { $current_url = eri_get_current_url( true, false); if ( (!current_user_can( ‘administrator’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX )) && (is_admin() || $current_url … Read more

Sort column in Users admin Tab

✅ You’ve added the column! ✅ You’ve told the admin UI it’s a sortable column! ❌ You didn’t implement the sorting of the user query. It’s not enough to tell WP Admin that you have a sortable column, how is it meant to know how to sort it ¯\_(ツ)_/¯! It’s not that clever, it has … Read more

WordPress 5.8 – Hide or Remove personal fields from admin Profile page

This is working for me in 5.8. Works in “adding new user” and in “edit user”. “Public display name” managed with a plugin. The code: // Remove fields from Admin profile page if ( ! function_exists( ‘cor_remove_personal_options’ ) ) { function cor_remove_personal_options( $subject ) { $subject = preg_replace(‘#<h2>’.__(“Personal Options”).'</h2>#s’, ”, $subject, 1); // Remove the … Read more