Guest post by Eliyahu Lev - Interactive Designer and WordPress Developer. Originally published in Hebrew here.
WordPress is an easy-to-use wonderful system. I keep telling clients “If you can handle Microsoft Word, you can handle WordPress”, but we can always make WordPress better. Attached are some tips and tricks for WordPress’ Admin Panel. All of the following code snippets should be added to the file functions.php. Don’t forget to backup before you start working.
Remove admin bar
I, personally, find the admin bar pretty annoying. This is how you remove it from your website:
add_filter('show_admin_bar', '__return_false');
Change the text in the footer
By default it says “Thank you for creating with WordPress”. My suggestion is to leave it as is, and add your credit as well:
function remove_footer_admin () { echo "Website By <a href="http://www.yourdomain">Your name</a>"; } add_filter('admin_footer_text', 'remove_footer_admin');
Remove widgets from the Home Screen
There is a lot of useless stuff here. This is how to hide it:
function tidy_dashboard(){ global $wp_meta_boxes, $current_user; // remove incoming links info for authors or editors if(in_array('author', $current_user->roles) || in_array('editor', $current_user->roles)) { unset($wp_meta_boxes['dashboard']['normal ']['core']['dashboard_incoming_links']); } // remove the plugins info and news feeds for everyone unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); //Right Now - Comments, Posts, Pages at a glance unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); //Recent Comments unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments']); //Incoming Links unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']); //Plugins - Popular, New and Recently updated WordPress Plugins unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins']); //Wordpress Development Blog Feed unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); //Other WordPress News Feed unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']); //Quick Press Form unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); //Recent Drafts List unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts']); } //add our function to the dashboard setup hook add_action('wp_dashboard_setup', 'tidy_dashboard');
Add a message to the login screen
This trick is great if you want to add some custom text / message to the login screen:
function custom_login_message() { $message = ' your message. '; return $message; } add_filter('login_message', 'custom_login_message');
Remove irrelevant Menus and Sub-Menus
If you want to prevent the client from certain functions such as changing the theme, or adding / removing plugins etc., here’s an example of how to remove parts of the menu:
function remove_submenus() {global $submenu; unset($submenu['index.php'][10]); // Removes 'Updates'. unset($submenu['themes.php'][5]); // Removes 'Themes'. unset($submenu['options-general.php'][15]); // Removes 'Writing'. unset($submenu['options-general.php'][25]); // Removes 'Discussion'. }add_action('admin_menu', 'remove_submenus');
Change the Logo on the login screen
By default, WordPress’ logo is displayed. You can change the image to your client’s logo. Pay attention to the image path “images/logo-admin.png”:
function custom_login_logo() { echo '</pre> <style type="text/css"><!-- h1 a { display:block; background-image: url('.get_bloginfo('template_director y').'/images/logo-admin.png) !important; width:330px!important; height:100px! important; background-size: 330px 100px!important; } --></style> <pre> '; } add_action('login_head', 'custom_login_logo');
Remove HTML editor in posts / pages
Avoid people messing with code. Don’t worry, the Admin will retain full access to the HTML editor:
add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') ); add_action( 'admin_head', 'disable_html_editor_wps' ); function disable_html_editor_wps() { global $current_user; get_currentuserinfo(); if ($current_user->user_level != 10) { echo '</pre> <style type="text/css"><!-- #editor-toolbar #edButtonHTML, #quicktags {display: none;} --></style> <pre> '; } }
Remove columns on the posts page
This snippet will help you remove select columns from the posts page, like author name, post category, tags and comments:
function my_columns_filter( $columns ) { unset($columns['author']); unset($columns['categories']); unset($columns['tags']); unset($columns['comments']); return $columns; } add_filter( 'manage_edit-post_columns', 'my_columns_filter', 10, 1 );