Remove admin AND editor from the “change role to” menu in user listing

Try using below code to remove administrator and editor option from drop down. Use editable_roles filter function wdm_user_role_dropdown($all_roles) { global $pagenow; if( current_user_can(‘editor’) && $pagenow == ‘user-edit.php’ ) { // if current user is editor AND current page is edit user page unset($all_roles[‘administrator’]); unset($all_roles[‘editor’]); } return $all_roles; } add_filter(‘editable_roles’,’wdm_user_role_dropdown’);

Remove ability to access certain admin menus

I figured it out in the end and this is the code I used: function restrict_menus() { $author = wp_get_current_user(); if( isset( $author->roles[0] ) ) { $current_role = $author->roles[0]; } else { $current_role=”no_role”; } if( ‘contributor’ == $current_role ) { $screen = get_current_screen(); $base = $screen->id; if( ‘edit-post’ == $base || ‘upload’ == $base || … Read more

Turn off admin emails for new user registrations

Function wp_new_user_notification is pluggable. It means that you can override it by declaring your version of this function in your plugin/theme. So, if you wish to disable all notifications completely, do it like this: if ( !function_exists( ‘wp_new_user_notification’ ) ) : function wp_new_user_notification( $user_id, $plaintext_pass=”” ) { return; } endif; However I wouldn’t recommend you … Read more

Using require_once() within admin

Avoid native php functions They are not relative, so breaking stuff is easy. (like in the OPs case) Why role your own if core got a function for you? They don’t consider edge cases You should NEVER use the constants STYLESHEET_DIRECTORY TEMPLATE_DIRECTORY WP_PLUGIN_DIR etc… Remember: Those are not API! and can therefore change! but INSTEAD … Read more

Custom CSS In Admin Only For Certain Roles

Upon request I will write an answer using a function from a suggested answer for the similar question: How to target with css, admin elements according to user role level?. This function will output classes to the body element for all roles of the current user in the form role-XXXXX function wpa66834_role_admin_body_class( $classes ) { … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)