Remove WordPress Dashboard widget by function.php

WordPress has some default widget. If you wanna remove the widgets this code snippet is for you. You can also hide this widgets by Screen Option in the top right corner of admin area. For removing your  WordPress default widgets please follow the steps below.

N.B: Please keep a backup of your theme function.php file before any changes.

Follow the steps:

  1. Open your theme function.php file
  2. Copy the code and paste it your theme function.php file at the bottom of file before php file closing sign ?>
  3. //remove WordPress deshboard widget
    function disable_dashboard_widgets() {
    remove_meta_box('dashboard_right_now', 'dashboard', 'core');
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'core');
    remove_meta_box('dashboard_incoming_links', 'dashboard', 'core');
    remove_meta_box('dashboard_plugins', 'dashboard', 'core');
    remove_meta_box('dashboard_quick_press', 'dashboard', 'core');
    remove_meta_box('dashboard_recent_drafts', 'dashboard', 'core');
    remove_meta_box('dashboard_gravfx_feed', 'dashboard', 'core');
    remove_meta_box('dashboard_primary', 'dashboard', 'side');
    remove_meta_box('dashboard_secondary', 'dashboard', 'side');
    add_action('admin_menu', 'disable_dashboard_widgets');
  4. Save the file.
  5. Finish!

applying the code in your theme function.php file you will get your dashboard clean. No one default widget will exist in your dashboard. If you wanna keep any specific widget just delete the those line from the code.

Tags : , , , , ,

Share on :

One Response to “Remove WordPress Dashboard widget by function.php”

  1. ZIHAN says:

    Thanks. Usefull Tricks. We need a post about creating custom wordpress photo gallery which have pagination without plugin.

Leave a Reply to ZIHAN

− six = 3