Removing Default Widgets from the Dashboard (WordPress)


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Create the function to use in the action hook
  2. function example_remove_dashboard_widgets() {
  3. // Globalize the metaboxes array, this holds all the widgets for wp-admin
  4.  
  5. global $wp_meta_boxes;
  6.  
  7. // Remove the incomming links widget
  8. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']);
  9.  
  10. // Remove right now
  11. unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']);
  12. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']);
  13. unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary']);
  14. }
  15.  
  16. // Hoook into the 'wp_dashboard_setup' action to register our function
  17. add_action('wp_dashboard_setup', 'example_remove_dashboard_widgets' );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.