문제

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.

도움이 되었습니까?

해결책 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

다른 팁

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');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top