Quick Tip: Customising and Simplifying the WordPress Admin for Your Clients

Quick Tip: Customising and Simplifying the WordPress Admin for Your Clients

When you’re building a website for your client, sometimes there are parts of the WordPress admin that you don’t need them to be able to access. In fact, if they don’t need to access them, why not get them out of the way and simplify the admin for your client. Here’s how…


Step 1 Setting Up Your Plugin

As per usual, you need to get your plugin setup before you can add any functionality to it. Create yourself a directory under /wp-content/plugins/ called wptuts-simple-admin. Now inside that directory, create the main PHP file for your plugoin. For the sake of standardisation, we’ll call it wptuts-simple-admin.php.

Inside this file is where we put the plugin header information:

<?php
/*
Plugin Name: Wptuts+ Simple Admin
Plugin URI: http://wp.tutsplus.com/articles/tips-articles/quick-tip-simplifying-the-wordpress-admin-for-your-clients
Description: Hides parts of the WordPress admin to keep it simple.
Version: 0.1
Author: Japh
Author URI: http://wp.tutsplus.com/author/Japh
License: GPL2
*/
?>

We’re going to write this plugin with object-oriented programming, which Tom recently introduced for those who are unfamiliar, so we’ll setup our class below the plugin header:

<?php
class Wptuts_Simple_Admin {

	function __construct() {
		// We'll add hooks here
	}

}

$wptuts_simple_admin = new Wptuts_Simple_Admin();
?>

At this point, you can log into your WordPress admin and see the plugin. You can also activate it now, and then go back and refresh as we add functionality.


Step 2 Hiding Menus We Don’t Need

Let’s say your client’s site doesn’t make any use of ‘Links’, and you don’t need your client to use anything in ‘Tools’ or ‘Settings’ either (that’s your job afterall, right?). So let’s turn them off (highlighted lines are new code):

<?php
class Wptuts_Simple_Admin {

	function __construct() {
		// Hook onto the action 'admin_menu' for our function to remove menu items
		add_action( 'admin_menu', array( $this, 'hide_menus' ) );
	}

	// This function removes each menu item using the Page Hook Suffix ( http://codex.wordpress.org/Administration_Menus#Page_Hook_Suffix )
	function hide_menus() {
		// Links page
		remove_menu_page( 'link-manager.php' );
		// Tools page
		remove_menu_page( 'tools.php' );
		// Settings page
		remove_menu_page( 'options-general.php' );
	}

}

$wptuts_simple_admin = new Wptuts_Simple_Admin();
?>

Step 3 Tidy Up Dashboard Widget Clutter

I don’t know about you, but I find there are several dashboard widgets on every WordPress install that I simply don’t need, and my clients certainly don’t care about. Those are: Incoming Links, Plugins, WordPress Blog, and Other WordPress News. Admittedly it could be argued that ‘Incoming Links’ has a usefulness, but I prefer to hide it and save on clutter.

Now, dashboard widgets are metaboxes, so we can use the following code to get rid of them (again, highlighted lines are new code):

<?php
class Wptuts_Simple_Admin {

	function __construct() {
		// Hook onto the action 'admin_menu' for our function to remove menu items
		add_action( 'admin_menu', array( $this, 'remove_menus' ) );
		// Hook onto the action 'admin_menu' for our function to remove dashboard widgets
		add_action( 'admin_menu', array( $this, 'remove_dashboard_widgets' ) );
	}

	// This function removes each menu item using the Page Hook Suffix ( http://codex.wordpress.org/Administration_Menus#Page_Hook_Suffix )
	function remove_menus() {
		// Links page
		remove_menu_page( 'link-manager.php' );
		// Tools page
		remove_menu_page( 'tools.php' );
		// Settings page
		remove_menu_page( 'options-general.php' );
	}

	// This function removes dashboard widgets
	function remove_dashboard_widgets() {
		// Remove each dashboard widget metabox for Incoming Links, Plugins, the WordPress Blog and Other WordPress News
		remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
		remove_meta_box('dashboard_plugins', 'dashboard', 'core');
		remove_meta_box('dashboard_primary', 'dashboard', 'core');
		remove_meta_box('dashboard_secondary', 'dashboard', 'core');
	}

}

$wptuts_simple_admin = new Wptuts_Simple_Admin();
?>

Step 4 Simplify Post Type Columns

The last screen I’ll cover for simplification in this article is the post listing screen (for both posts and pages). If your client is just one person, writing all their posts themselves, why do they need to see the author column? Sounds like wasted space to me.

<?php
class Wptuts_Simple_Admin {

	function __construct() {
		// Hook onto the action 'admin_menu' for our function to remove menu items
		add_action( 'admin_menu', array( $this, 'remove_menus' ) );
		// Hook onto the action 'admin_menu' for our function to remove dashboard widgets
		add_action( 'admin_menu', array( $this, 'remove_dashboard_widgets' ) );
		// Hook onto the post type-specific filters to remove columns
        add_filter( 'manage_posts_columns', array( $this, 'remove_columns' ) );
        add_filter( 'manage_pages_columns', array( $this, 'remove_columns' ) );
	}

	// This function removes each menu item using the Page Hook Suffix ( http://codex.wordpress.org/Administration_Menus#Page_Hook_Suffix )
	function remove_menus() {
		// Links page
		remove_menu_page( 'link-manager.php' );
		// Tools page
		remove_menu_page( 'tools.php' );
		// Settings page
		remove_menu_page( 'options-general.php' );
	}

	// This function removes dashboard widgets
	function remove_dashboard_widgets() {
		// Remove each dashboard widget metabox for Incoming Links, Plugins, the WordPress Blog and Other WordPress News
		remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
		remove_meta_box('dashboard_plugins', 'dashboard', 'core');
		remove_meta_box('dashboard_primary', 'dashboard', 'core');
		remove_meta_box('dashboard_secondary', 'dashboard', 'core');
	}

	// This function removes post / page list columns
	function remove_columns( $defaults ) {
		unset( $defaults['author'] );
		return $defaults;
	}

}

$wptuts_simple_admin = new Wptuts_Simple_Admin();
?>

Conclusion

It’s little customisations like these that allow you to make WordPress’ admin feel tailored to your client’s needs. There’s more you can do, of course, and you’ll likely vary things on a client-by-client basis. Some of these things can be done using Aaron Rutley’s excellent Minimal Admin plugin.

If you wanted to take this up a notch, you could also include capability checks to disable / enable functionality based on who’s logged in.

How do you like to customise WordPress for your clients? Let us know in the comments below.

Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • Richard

    Just one thought, if we want to restrict access or disable specific sections isn’t it pointless to do it with a plugin when they can simply deactivate it? Wouldn’t it be better to use functions.php instead?

    • http://wp.tutsplus.com/ Japh
      Author

      Hi Richard, you could put this plugin into mu-plugins, so that it cannot be disabled (as mentioned by Damian above). Also, you could remove the Plugins menu if it wasn’t super critical (as these pages can still be accessed from the URL).

      • Richard

        Hi Japh, thanks for the info about mu-plugins, I didn’t know about that. One question tho, how many plugins should I use on a single website? Is there any difference between using plugins and functions.php in performance?

        • http://wp.tutsplus.com/ Japh
          Author

          My pleasure, Richard. If you need to read more about mu-plugins, you can do so in the Codex.

          Regarding number of plugins and performance: The number of plugins used on a single site is of little importance. What’s more important is that they be well coded plugins (which unfortunately can be harder to judge). The performance difference between a plugin and code in a functions.php file is extremely negligible. The advantages of having the functionality in a plugin outweigh any performance gain thousands of times over. There are plenty of other areas where performance attention is better spent :)

          • Richard

            I’m just thinking if it’s not better to use a functions.php because I’m afraid that clients could easily deactivate or delete the plugin (by accident) and then break the functionality of the site without them even knowing. Is it possible to move all of the plugins in mu-plugins to prevent this? Or are there any restrictions?

          • http://wp.tutsplus.com/ Japh
            Author

            Hi Richard, why not just use the plugin from this article in mu-plugins and hide the Plugins menu? ;)

            Not all plugins will work in mu-plugins. Read the Codex page for more info on that.

          • Richard

            Thanks Japh, good idea! :)

  • Pingback: Algo sobre esto y aquello » Blog Archive » Personalización y simplificación del admin de WordPress para tus clientes

  • http://7degrees.co.uk/ Damian Gostomski

    What a coincidence – Earlier today I coded up a quick plugin to do the exact same thing (and a few extras).
    These are things I find myself doing on pretty much every client project, so thought I’d standardise it into a plugin.

    As well as the above, mine also sticks in a custom logo on the login screen (if a file admin-logo.png exists in the theme) and relabels “Posts” to “Articles”. You can find my quick plugin here: https://github.com/damiangostomski/wordpress-admin-refresh

    Richard – If you’re concerned about the end user disabling the plugin, you can always not make them an admin, so they can’t manage plugins, or put it in mu-plugins so it can’t be deactivated.

    • harishchouhan

      Does your plugin work on WordPress network? and if it does, is there a way to restrict access to those things (menus, etc.) for everyone except the super admin?

      • http://7degrees.co.uk/ Damian Gostomski

        Although I’ve not tested it in MultiSite, I can’t see any reason why it wouldn’t work.

        As for restricting access to all but the super admin, if you want to do anything regarding per user permissions, I would suggest editing user capabilities to prevent them from being able to do something instead of just hiding it.

        In the cases I need it, removing the menu item is sufficient, as the removed items aren’t needed 99.9% of the time, so there’s no point them cluttering up the menu, but if you do need them, you can still access them directly by URL.

        • harishchouhan

          Thanks for the quick reply Damian. Just checked your plugin code. This is going to be very useful for me. Thanks again.

    • http://wp.tutsplus.com/ Japh
      Author

      Amazing coincidence, Damian! Thanks for the link to your plugin’s GitHub repo too. I like the idea of a custom login screen logo.

  • harishchouhan

    Great Article Japh. I use similar code in my functions.php for client projects. Now trying to make a plugin that could be activated on a network.

    • http://wp.tutsplus.com/ Japh
      Author

      Thank you! I like to keep this functionality out as a plugin, personally. It just makes it simpler to transfer between projects.

      • harishchouhan

        Ye plugin is the right way to do it. However I just learned plugin development recently. So would be using this code now. Would you mind, if i use this code and build upon it before submitting to WP repo? just want to use this as a base.

        • http://wp.tutsplus.com/ Japh
          Author

          Hey Harish, this code is GPL2, so you can use it if you wish according to those terms. Hopefully the plugin you release there does a lot more than this :)

          • harishchouhan

            Hey Japh, would you be interested in checking my plugin once its done and even contributing if time permits?

          • http://wp.tutsplus.com/ Japh
            Author

            I’d be happy to give it a look over if time permits :)

  • Pingback: 40 Free Wordpress Video Tutorials Now Available for Easy Wordpress … | Open Knowledge

  • http://www.mojowill.com/ theMojoWill

    Hi Japh, I actually have already written and released a nice little toolbox for exactly this purpose. http://wordpress.org/extend/plugins/the-mojo-admin-toolbox/

    • http://wp.tutsplus.com/ Japh
      Author

      Great work, Will! Just had a look at the plugin, and it sure looks like a lot of thought has gone into it :)

  • http://twitter.com/steve228uk Stephen Radford

    Strikes me that it might just be easier to dump it as a function in your themes functions.php file.

    • http://wp.tutsplus.com/ Japh
      Author

      Hi Stephen, I don’t think this would actually be any easier at all. In fact, it’s probably less flexible in several ways (time, convenience, version control, etc.)

      Certainly you could do it that way, and really it’s down to personal preference in terms of how you deal with your clients’ sites.

  • Pingback: WPMU's Best in WordPress - November 19th to November 25th

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | Pay With a Like

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | KimberlyL Blog

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | My BlogMy Blog

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | CMS Radar

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | iwebspider design and consulting

  • Lance Butler

    Japh – Always nice to see articles covering the topic of making wordpress a product for a client in any scope (whether it’s about cleaning up the backend, or providing useful functionality for clients).

    On a side note, I wanted to say that I really really really liked the way you did the highlighted code (for new code). Certainly we’ve all read tutorial after tutorial…I haven’t seen this approach before, but it was awesome (even for as small a code base as this) to be able to see the whole class at once, and quickly/effortlessly focus on what was added. Thanks, man!

    • http://wp.tutsplus.com/ Japh
      Author

      Hey Lance, thanks for your feedback. I’m really glad you found this useful and liked the approach.

      I’m also very happy to get your feedback on the highlighting approach. To be honest I hadn’t seen this done until one of our other authors, Soumitra, did it in his most recent two tutorials. I thought it was a fantastic way to present new steps within the context of previous steps too :)

      • Lance Butler

        I could see how with complex code or classes, it may become irritating seeing the whole thing over and over again in a tutorial as you’re scrolling down. But NOTHING is more irritating to me than to have to continuously scroll back up to remember the context of ‘new’ code as it relates that what was covered a few paragraphs ago…and then scroll back down…and then rinse and repeat. This is just one guy’s opinion for sure, though. Either way, thanks again, keep up the good work. I appreciate all the stuff you authors put together for us.

        • http://wp.tutsplus.com/ Japh
          Author

          Yes, this was actually part of the reason that I didn’t make this tutorial longer (just a part though).

          I’m sure it could be made to work. I’ll be trying to utilise it next time I write a tutorial, for sure!

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | Plum

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | iblogwp.net

  • Vadims

    Hey Japh, excellent article and I must agree with the others commenting the highlighted code that it is very usefull and I hope more authors will use it in the future.

    It would be great thought if you could go deeper into the UI customizations of the admin, maybe by showing the ways to add or remove columns from the posts, custom posts and pages edit page or making them sortable, how to insert custom column filters to narrow down the displaying records with more options etc. Well, maybe in one of your next articles!

    • http://wp.tutsplus.com/ Japh
      Author

      Great suggestions, @vadims00:disqus, thanks! :)

  • netbiel

    Japh, I found your article very useful. I always tried to add cms features to my wordpress when I develop a website for my clients. I released my own plugin (CMS admin area) two months ago. It ads user-friendly horizontal menu and removes bloging platform widgets. http://wordpress.org/extend/plugins/cms-admin-area/

  • Pingback: Tweet Parade (no.48 Nov-Dec 2012) | gonzoblog

  • http://freakify.com Ahmad Awais

    Nice additions to my knowledge of WordPress after reading this article. Found it great. Thumbs up for you Japh.

    • http://wp.tutsplus.com/ Japh
      Author

      Thank you, @mrahmadawais:disqus! Glad to hear you got something out of it :)

  • http://twitter.com/CategoryCode CategoryCode

    Handy tutorial! Clients always want full access but if you provide them simply want they need odds are things will be much smoother!

  • Pingback: Quick Tip: Customising and Simplifying the WordPress Admin for Your Clients | Web Sys Technology Pvt Ltd

  • granite worktop birmingham

    Ervaar de kracht van SIMPELHEID in een webwinkel software. Probeer onze software 30 dagen gratis! Direct Webwinkel Starten

    http://www.nowopen.nl/

  • http://aldenrobbins.webstarts.com/ DillonFrazier

    Awesome chance, Damian! Thanks for the weblink to your plugin’s GitHub repo too. I like the concept of a customized sign in display logo.

  • Alex Vel

    I admit i only glanced at the article so correct me if i am wrong, but, does the activation of the plugin will remove all this stuff for every user type in the wordpress installation? How am i supposed to manage plugins after this since i am the developer? Wouldn’t be more usuful if the plugin hides all these only for certain user types and not the admin?

    • http://wp.tutsplus.com/ Japh
      Author

      Hi Alex Vel, you’re absolutely right on all points. However, this was just a quick tip to demonstrate admin customisation, so roles and capabilities were outside the scope of this tutorial.

      In the conclusion though, I did mention that “if you wanted to take this up a notch, you could also include capability checks to disable / enable functionality based on who’s logged in.”

  • Pingback: Best of Tuts+ in November 2012 - Website Design Prices

  • Pingback: Quick Tip: Customising and Simplifying the WordPress Admin for Your Clients | Wptuts+- Brad Mehder

  • Pingback: Best of Tuts+ in November 2012 | BuildsiteUs

  • Pingback: WPMU’s Best in WordPress – November 19th to November 25th | WordPress Community | powered by Mpress Studios