Home Customize the WordPress Admin Panel Meta Boxes (and Change the Default News...

    Customize the WordPress Admin Panel Meta Boxes (and Change the Default News Feed)


    The snippets on this page were migrated from the now retired Internoetics website. If you find any errors or omissions, please let us know (it was written before WP made their own panel modifications).

    ■ ■ ■

    If you design a website for a client you’ll invariably want to white-label WordPress in different ways to better reflect their (or your) own brand. Depending upon the specific needs of your customer, you might consider altering the appearance of the WordPress administration dashboard to better suit their needs. The dashboard displays an activity log, quick draft area, the “at a glance” information, and WordPress news – all by default (and much of it irrelevant). It’s likely you’ll want to customize these areas – particularly the news feed that you can alter for your own website. If you’re writing plugins there’s also a good chance you may want to add a meta box on the dashboard to support your app.

    This article will show you how to add simple meta boxes to the dashboard, and how to remove the default news feed and replace it with your own.

    Removing Meta Boxes from the Admin Panel

    The WordPress Codex page details how to remove meta boxes from a particular post edit screen for a particular post type (in our example, dashboard). If you’re deploying WordPress to a client you may want to remove specific boxes that are largely irrelevant (the WP news RSS feed with forced WPtavern news is one such example). To use the following function, uncomment the meta boxes you choose to remove.

    On a network site you should use ‘dashboard-network’ as the second parameter rather than ‘dashboard’.

    I use once used the plugin wp-filebase and it includes an unwanted meta box in my admin panel. Because ‘admin_menu’ is fired early, it renders the box after wp_dashboard_setup, so we use the do_meta_boxes action instead. As per the WP Codex, this is handy if you want to limit meta boxes by user role (the do_meta_boxes hook is called in the wp-admin/edit-form-advanced.php file after all the meta boxes have been added to the page).

    The remove_meta_box function can be used to remove any meta boxes from any page type. As mentioned, the boxes can be removed depending upon the user role , meaning you can discriminately render different pages to authors depending upon their privileges.

    Add a Simple Meta Box to the Administration Panel

    To display a simple meta box in the admin panel we make use of wp_add_dashboard_widget and wp dashboard setup . The function is as follows:

    The beliefmedia_custom_dashboard_widget_output is used to print any content. You would normally be calling the content as an option or returning genuine dynamic content.

    Customize the WordPress Admin Panel Meta Boxes (and Change the Default News Feed)

    The rendered Meta Box (from both examples)

    To display the meta box in a particular location rather than just rendering underneath others (which is the default behaviour), you should use the add_meta_box function instead. In company with our beliefmedia_custom_dashboard_widget_output() (callback) function that we used to generate the returned HTML, you can use the following rather than the beliefmedia_custom_dashboard_widget function and wp_dashboard_setup action.

    The function parameters are listed here .

    Replacing the default WordPress Dashboard Feed

    By default WordPress includes a feed that includes WordPress and other news. If you’ve built a website for a client it’s fair to say that they’ll be more interested in your (RSS) news feed than the techie-type WP news displayed by default.

    Adding one or more feeds is done in the manner described below. We’ve used wp_widget_rss_output to generate the feed (replacing the text in the functions above).

    The widget will now show your own feed rather than WordPress’. Screenshot below.

    Customize the WordPress Admin Panel Meta Boxes (and Change the Default News Feed)


    • We have a shortcode scheduled that will merge multiple RSS feeds. As part of that article we provide code that will render multiple feeds in a meta box as we’ve done above.
    • In another scheduled article we use the dashboard meta box to include a form that’ll update core elements of your website.
    • This post is quite old. Please report errors.

    Short URL for this post: http://shor.tt/1XIe