Create a Standalone WP Care Plan Dashboard View Using the WordPress Admin

Standalone WP Care Plan Dashboard View

*Disclosure: This post may contain affiliate links. If you buy through links on our site, we may earn an affiliate commission at no cost to you. Read the full disclosure for more information.

In this tutorial, I’m going to show you how you can provide access to the WP Care Plan dashboard without your client being able to access the rest of the WordPress admin.

There’s several reasons why you might want to take this approach:

  • You don’t want to provide admin access to your client.
  • You don’t want to overwhelm your client with the rest of the admin.
  • Your client never logs into WordPress, but you still want them to have a place where they can view the WP Care Plan dashboard.

The first method uses WPCodeBox, a WordPress plugin that allows you to manage code snippets. I prefer using WPCodeBox because I’m already using it as part of my tech stack, and I can easily save this code snippet to the cloud and quickly enable it on any future website build.

Instructions using WPCodeBox

Step 1:

Within WordPress, navigate to Users > Add New and create a new user account for your client with the ‘administrator’ user role.

Step 2:

If you haven’t already, download, install and activate WPCodeBox.

Note: WPCodeBox is a premium plugin, but is well worth the investment. It currently also comes with WPCodey, which AI-generates WordPress Code Snippets based on your prompts.

Step 3:

Create a new snippet with the following details:

Type: PHP

Title: Restrict User Access to WP Care Plan & Account

Description: This code snippet restricts access for a specific WordPress user to the WP Care Plan dashboard and their account page. You must replace BOTH instances of “clientusername” with the actual username of the user you wish to restrict access for in the provided code snippet below.

How to run the snippet: Always (On Page Load)

Priority: 10

Where to run the snippet: Everywhere

This is the code snippet to copy and paste (editing both instances of ‘clientusername’):

<?php

// Remove admin menu items for a specific user.
function wpcp_remove_admin_menu_items() {
    global $menu;
    global $current_user;
    get_currentuserinfo();

    if($current_user->user_login == 'clientusername') { // replace username with the username you want to see the WP Care Plan dashboard only
        $restricted = array(__('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
        end ($menu);
        while (prev($menu)){
            $value = explode(' ',$menu[key($menu)][0]);
            if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
        }
    }
}
add_action('admin_menu', 'wpcp_remove_admin_menu_items');

// Hide all remaining menu items (unknown plugins, for example) with CSS.
function wpcp_custom_admin_css() {
    global $current_user;
    get_currentuserinfo();
    
    if($current_user->user_login == 'clientusername') { // replace username with the username you want to see the WP Care Plan dashboard only
        echo '<style>
            /* Hide the left menu in the top menu bar, with exception to the WP Care Plan link */
            #wpadminbar .quicklinks .ab-top-menu:not(.ab-top-secondary)>li:not(#wp-admin-bar-wp-care-plan-shortcut) { display: none; }
        
            /* Hide the right menu in the top menu bar, with exception to My Account link */
            #wpadminbar .quicklinks .ab-top-secondary>li:not(#wp-admin-bar-my-account) { display: none; }
        
            /* Reset the left margin to fill the space of the menu */
            #wpcontent, #wpfooter { margin-left: unset; }
        
            /* Hide the left menu entirely */
            #adminmenumain { display: none; }
        </style>';
    }
}
add_action('admin_head', 'wpcp_custom_admin_css');

Save and enable the code snippet in WPCodeBox.

Here’s a screenshot of how this looks:

Screenshot of WBCodeBox

Step 4:

In Settings > WP Care Plan, make sure the “Replace default WordPress Dashboard with the WP Care Plan Dashboard” setting is checked.

Don’t use WPCodeBox or would prefer to implement using your themes’ functions.php file?

Instructions using functions.php

Step 1:

Within WordPress, navigate to Users > Add New and create a new user account for your client with the ‘administrator’ user role.

Step 2:

Insert the exact code found in Step #3 above (under the WPCodeBox method) in your theme functions.php.

You must replace BOTH instances of “clientusername” with the actual username of the user you wish to restrict access for in the provided code snippet below.

Step 3:

In Settings > WP Care Plan, make sure the “Replace default WordPress Dashboard with the WP Care Plan Dashboard” setting is checked.

That’s all!

Now your client can login to WordPress and will only have access to the WP Care Plan dashboard and their account. Having access to their account will allow them to change their email address, which is important for them to be able to manage so you do not need to do it on their behalf.

Additional Tips

Set a redirect for a custom login URL

If you aren’t keen on sharing the default /wp-admin/ login URL, you can set a redirect to it using either a redirection plugin, or most SEO plugins have built-in functionality to set redirects. In most cases, I’m using either SEOPress Pro, Slim SEO, or Redirection for my redirects. This would allow you to set up a redirect such as /careplan/ → /wp-admin/, for example.

Customize the login URL

You can also permanently change the admin login URL using WPS Hide Login or Perfmatters. For example, you may use your agency name.

Brand the login page

In Settings > WP Care Plan, you can display a custom logo on the login page so your client doesn’t feel like they are logging into something unknown. We recognize the WordPress ‘W’ icon because we see it daily. But it often doesn’t mean anything to our clients. As the ones building the websites, we can neglect the login experience. For a client, it provides security and builds brand awareness simply by switching out the default WordPress icon with your logo on the login page.

You can take it a step further and install the White Label CMS plugin (free on the WordPress plugin repository). With this plugin, you have much greater customization of the WordPress login page.