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?
- 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?
- Admin Page Redirect
- 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?
- 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
- 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
- Moving wordpress from localhost to server throws admin panel access error?
- How to disable admin flyout menus?
- How to display multiple custom columns in the wp-admin users.php?
- 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]
- 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”)
- 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
- 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
- Restrict Author role to only 3 wp-admin pages
- wrapping ‘rest_api_init’ in ‘is_admin()’ function
- Add column to pages table
- Logout USER form backoffice after 30 minutes of inactivity [closed]
- Remove or move admin submenus under a new menu
- WP admin user search doesn’t return all users
- I can´t access my admin panel. I tried all possible solutions
- 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?
- 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
- How to allow WordPress updates to only one specific administrator?
- Is there a filter to edit html of user-edit.php
- 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
- 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
- On Users (user.php) in wp-admin disable/hide “Bulk Actions” and “Change Role To”
- Not able to access WP Admin, it says “Sorry, you are not allowed to access this page.”
- WordPress Admin Panel Left Sidebar No showing on Post create page
- Weird white space in admin area
- How to logout the current user without notices and warnings?
- Login issue with subdomain installs
- Redirect from wp-admin back to page
- Hook into form handle from admin users table
- Remove menu item dashboard for a unique user
- CSRF attack to create USER
- How to display status messages in admin panel
- adding existing menu page on new customer user role
- Disable flyout (popup) menus in backend
- Remove capability to interact with a page
- Localhost install: Administrator lost administrator access; cannot access Dashboard
- How to keep the plugin submenu open on viewing a custom version of users.php?
- Anyone Can Register
- WordPress blog fails to open
- Redirection to external site on admin
- Move Custom Taxonomy Menu to Top Level Admin Menu
- Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
- Extend user search in the Wp backend area on the users.php page to allow for searching by email domain and role from the “users search” input box
- WordPress Users page missing user count next to different types of users
- get_current_screen() does not return parent_file
- After Upgrade: $user becomes unknown (id: 0) after successful login?
- Searching for a custom meta from user.php in the admin