Add the following, to functions.php
of the current theme (child theme is preferred!):
CSS solution:
function no_email_changes_in_profile() {
$screen = get_current_screen();
if ('profile' == $screen->base && !current_user_can('manage_options')) {
echo '<style>
input#email {
pointer-events: none;
}
</style>';
}
}
add_action('admin_head', 'no_email_changes_in_profile');
jQuery solution:
function no_email_changes_in_profile() {
$screen = get_current_screen();
if ('profile' == $screen->base && !current_user_can('manage_options')) {
echo "<script>
jQuery(document).ready(function($) {
$('#email').prop('readonly', true);
});
</script>";
}
}
add_action('admin_head', 'no_email_changes_in_profile');
This will disable editing of ‘Email’ field on the profile admin page, for all users, except of an administrator.
Related Posts:
- define two login page url
- Is it possible to tell if a user is logged into WordPress from looking at the cookies which are set?
- WordPress change role from administrator to author by itself (automatically)
- How to check if a user is in a specific role?
- How do I Enqueue styles/scripts on Certain /wp-admin Pages?
- Changing Admin Menu Labels
- Is there ANY way to remove comments function and section totally?
- How to restrict dashboard access to Admins only?
- Admin Page Redirect
- Check if user is admin by user ID
- Can an admin check passwords of registered users?
- Add “external” link to admin menu in the backend
- How to add custom submenu links in wp-admin menus?
- Edit specific nodes in WP_Admin_Bar
- How to add notification bubble for my custom admin menu page
- How to display the user that published a pending post?
- How to create sub menu with a URL parameter?
- Custom user role that can only edit specific (non-custom-type) page and all child pages [duplicate]
- Adding a menu item in the admin bar
- Only allow administrators and editors to access wp-admin
- How to remove items from +New admin menu?
- Reorder custom submenu item
- Add a button to users.php
- create users to site with specific language
- Make sub menu items a main link in the admin menu using fuctions.php
- Add column to pages table
- Admin account only shows Profile and Dashboard with no activity
- How to wrap admin menus and menu headers in additional divs without modifying the WordPress core?
- Moving wordpress from localhost to server throws admin panel access error?
- How to disable admin flyout menus?
- Display sortable User meta column in admin panel user’s page
- How to display only logged in user’s post comments in comments area
- How to display multiple custom columns in the wp-admin users.php?
- Hooking into register_admin_color_schemes
- remove plugin admin menu in wordpress without installing plugin in v3.8.1
- How to prevent parent admin page from appearring as a child admin page
- Removing user fields [duplicate]
- Rename W3 Total Cache admin menu
- How to inhibit dashboard and profile management access to normal users?
- wp-admin edit user url wont show up correct url [closed]
- Users Unable to Access Dashboard/Posts/Pages
- Only allow administrators and editors to access wp-admin
- Stop loading “collaborators” users on add new post or page?
- Remove query var on admin pages when ‘Save changes’ pressed
- Distinguish profile user and admin user IDs / get ID of user being edited
- Create a admin page in wordpress without admin menus (“wordpress sidebars”)
- Can’t access WordPress as an admin – but I can log in as a user!
- Uncheck the box “Send User Notification” by default on new-user.php
- Detecting all admins that are logged in
- Redirect non-admin users away from wp-admin/index.php (main dashboard page) to wp-admin/profile.php
- Subscribers become Authors after Upgrade? / Mass Update of Users?
- Stopping user deletion from running on error
- Remove All in One Pack from the admin bar
- Filter dropdown in users.php “delete user” bulk edit screen
- Cannot find an OLD Gravity Form on an OLD Word Press site [closed]
- Add count for new registered user in Users tab
- admin_post action not usable if admin access denied to user
- Restrict Author role to only 3 wp-admin pages
- Users disappeared from wp-admin
- wrapping ‘rest_api_init’ in ‘is_admin()’ function
- Add column to pages table
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Add menu option to “New Post” menu in admin bar
- Admin menu in front-end
- Remove or move admin submenus under a new menu
- WP admin user search doesn’t return all users
- Hide username discovery
- I can´t access my admin panel. I tried all possible solutions
- How to get Role Subscribe Users on Admin Menu only in Pages in WordPress
- Lost administrator privileges and can’t find a fix
- I accidentally deleted an admin user and all their content is now gone from the site. [closed]
- How to remove dashboard access (wp-admin) for author but not disable the capabilities?
- Restrict submitters from wp-admin [duplicate]
- How to get specific page screen ID
- Deploying WordPress for clients – what do they have access to?
- Removing Dashboard Menu Items Through The Database
- WordPress Side Menu Admin Panel Default Order numbers List?
- load-{$page hook} and returned parameter
- Hide admin menu on update_option
- meta box on new admin page
- How to hide Admin Tabs? [duplicate]
- Making Comments, a sub_menu in admin menu
- Admin top level menu, pointing to an external url
- Is there a plugin for WordPress for creating ‘Accounts’ where all users who belong to that Account can only see Account data? [closed]
- How to break line / add to ADMIN menu
- Nickname field isn’t appearing in Admin
- How to Find The Email of a WP Admin Account
- How to allow WordPress updates to only one specific administrator?
- Creating custom admin panel pages without making a plugin?
- Is there a filter to edit html of user-edit.php
- Change users.php WP_User_Query
- Create new user from phpMyAdmin
- How can I control which plugins run in the dashboard?
- how to stop wordpress admin menu from scrolling with page
- How do I make it so that the all users page is not a white screen?
- Is WordPress secure enough for a multi-user article directory?
- Trying to create a page as a menu item in the admin while keeping the admen panel visible
- Newly created user role not displaying on users screen
- Custom admin menu order fails if slugs are complicated
- Admin Page access