How to display message (with switch_theme hook) after deactivating My theme?

It’s impossible, because after deactivation your theme isn’t even loaded! It’s possible, but hacky. Essentially, we unset the action param, load in the themes admin page & then exit before the redirect-on-success occurs. add_action( ‘switch_theme’, ‘wpse_60972_theme_deactivate_message’ ); function wpse_60972_theme_deactivate_message() { $msg = ‘ <div class=”error”> <p>Your theme has been DEACTIVATED</p> </div>’; add_action( ‘admin_notices’, create_function( ”, … Read more

Fixed layout for admin section

This is still to be confirmed but so far so good: What I did is open all the minified css related to the admin section and deleted theses parts @media only screen and (max-width:xxx px){…} whenever I found one. It seems to work and doesn’t mess with anything else, as far as I know. Of … Read more

WordPress Remove Submenus

Replace all occurrences of $current_user->user_login == ‘username’ with in_array(‘editor’, $current_user->roles). And you can remove the call to get_currentuserinfo(); as for the user information is available from the global variable $current_user. Here’s a code swap: add_action(‘_admin_menu’, ‘remove_editor_submenu’, 1); function remove_editor_submenu() { global $current_user; if(in_array(‘editor’, $current_user->roles)) { remove_action(‘admin_menu’, ‘_add_themes_utility_last’, 101); } } add_action(‘admin_init’, ‘remove_theme_submenus’); function remove_theme_submenus() { … Read more

How to change the name of the “edit my profile” link in the WordPress admin backend

You could use the wp_before_admin_bar_render hook. You can play with code samples on the Codex page by putting them in your theme’s functions.php. First off you can try examining the object by outputting its contents with print_r(), and you’ll see all the familiar items. I would probably use remove_menu helper and then add a new … Read more