Question

I am looking for a way to hide activity feed from the dashboard using a function. Does anyone know how to do this? I want to completely remove it. I want to achieve this without a plugin.

Was it helpful?

Solution 3

You'll either have to create a plugin or add a function to your theme functions.php file.

function remove_activity_dashboard_widget() {
    remove_meta_box( 'dashboard_activity', 'dashboard', 'side' );
} 

// Hook into the 'wp_dashboard_setup' action to register our function
add_action('wp_dashboard_setup', 'remove_activity_dashboard_widget' );

Here is the codex page on the subject:

http://codex.wordpress.org/Dashboard_Widgets_API#Advanced:_Removing_Dashboard_Widgets

OTHER TIPS

You can use remove_meta_box() like;

function remove_dashboard_widgets(){
    remove_meta_box('dashboard_activity', 'dashboard', 'normal');
}
add_action('wp_dashboard_setup', 'remove_dashboard_widgets');

add above code to functions.php

Dashboard widgets and other meta boxes can also be removed by using the unset function. You might need to play around with the array keys, or use var_dump() to find the path for the widget you're looking for.

 // Removes dashboard activity widget.
  function remove_dashboard_activity_widget() {
    global $wp_meta_boxes;
    unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']);
  }

  // Triggers dashboard widgets removal.
  add_action('wp_dashboard_setup', 'remove_dashboard_activity_widget');

Additionally like Hüseyin BABAL mentioned, meta boxes can also be removed like this:

function remove_dashboard_widgets(){
    remove_meta_box('dashboard_activity', 'dashboard', 'normal');
}

add_action('wp_dashboard_setup', 'remove_dashboard_widgets');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top