似乎还没有针对此的过滤器,但您可以取消注册默认活动小部件,并注册(在您的函数中,或者更好地在Dave Warfel推荐的插件中)具有自定义设置的类似活动小部件:
// unregister the default activity widget
add_action(\'wp_dashboard_setup\', \'remove_dashboard_widgets\' );
function remove_dashboard_widgets() {
global $wp_meta_boxes;
unset($wp_meta_boxes[\'dashboard\'][\'normal\'][\'core\'][\'dashboard_activity\']);
}
// register your custom activity widget
add_action(\'wp_dashboard_setup\', \'add_custom_dashboard_activity\' );
function add_custom_dashboard_activity() {
wp_add_dashboard_widget(\'custom_dashboard_activity\', \'Activity\', \'custom_wp_dashboard_site_activity\');
}
function custom_wp_dashboard_site_activity() {
echo \'<div id="activity-widget">\';
$future_posts = wp_dashboard_recent_posts( array(
\'display\' => 2,
\'max\' => 5,
\'status\' => \'future\',
\'order\' => \'ASC\',
\'title\' => __( \'Publishing Soon\' ),
\'id\' => \'future-posts\',
) );
$recent_posts = wp_dashboard_recent_posts( array(
\'display\' => 2,
\'max\' => 5,
\'status\' => \'publish\',
\'order\' => \'DESC\',
\'title\' => __( \'Recently Published\' ),
\'id\' => \'published-posts\',
) );
$recent_comments = wp_dashboard_recent_comments( 10 );
if ( !$future_posts && !$recent_posts && !$recent_comments ) {
echo \'<div class="no-activity">\';
echo \'<p class="smiley"></p>\';
echo \'<p>\' . __( \'No activity yet!\' ) . \'</p>\';
echo \'</div>\';
}
echo \'</div>\';
}