How to customize dashboard by removing unnecessary menu or widgets

When creating a user based wordpress website, it is important to remove all the unnecessary information from the website. Although assigning capabilities does most of the job for you. Actually ‘capabilities’ is the most important part because it makes sure that users don’t access pages that they are not supposed to. But coming back to the article, we will just be hiding unnecessary documents but not stopping them to access those pages.

All the below settings can be done in your functions.php

  1. Remove wordpress logo from admin bar
    wordpress-logo

    // remove the wordpress logo from the toolbar
    function nzgo_remove_wp_logo( $wp_admin_bar ) {
        $wp_admin_bar->remove_node( 'wp-logo' );
    }
    add_action( 'admin_bar_menu', 'nzgo_remove_wp_logo', 999 );
    

     

  2. Edit footer that says “Thank you creating with WordPress”
    footer

    // Custom admin page footer
    function nzgo_edit_footer() {
        add_filter( 'admin_footer_text', 'nzgo_edit_text', 11 );
    }
    
    // Custom Text Here
    function nzgo_edit_text($content) {
        return "Thank you for using New Zealand Go Online";
    }

     

  3.  Remove widgets from Dashboard

    dashboard

    The simplest way to find id of meta box is to use ‘firebug’ kind of tool.

    function nzgo_remove_dashboard_meta() {
        remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
        remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
        remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
        remove_meta_box( 'dashboard_activity', 'dashboard', 'normal');
    }
    add_action( 'admin_init', 'nzgo_remove_dashboard_meta' );

     

  4. After removing all of the widgets, you may like to add your own custom widget
    function nzgo_add_dashboard_widgets() {
        wp_add_dashboard_widget(
            'nzgo_dashboard_widget', // Widget slug.
            'New Zealand Go Online', // Title.
            'nzgo_dashboard_widget_function' // Display function.
        );
    }
    add_action( 'wp_dashboard_setup', 'nzgo_add_dashboard_widgets' );
    
    /**
     * Create the function to output the contents of your Dashboard Widget.
     */
    function nzgo_dashboard_widget_function() {
        echo "Hello there, Welcome to New Zealand Go Online Dashboard";
    }
    

     

  5. Add a menu on admin toolbar with Home Link
    function nzgo_add_home_on_admin_bar() {
        global $wp_admin_bar;
        $wp_admin_bar->add_node(array(
            'id'    => 'home',
            'title' => 'Home',
            'href'  => home_url()
        ));
    
    }
    add_action( 'wp_before_admin_bar_render', 'nzgo_add_home_on_admin_bar' );

     

  6.  Remove unnecessary menu items from admin panel
    function nzgo_remove_admin_menus() {
        remove_menu_page ('profile.php');
        remove_menu_page ('upload.php');
        remove_menu_page ('tools.php');
    }
    add_action("admin_menu", "nzgo_remove_admin_menus");
    
    

     

Let me know if you are looking for any other kind of customization.  I’d love to help WordPress Community.

Leave a Reply

Your email address will not be published. Required fields are marked *