我想从仪表板中为特定用户删除以下两个小部件。1.站点统计信息2. Elementor概述
我没有成功地搜索到小部件ID。下面是我的代码:
add_action( 'admin_init', 'remove_widgets' );
function remove_widgets($query) {
if(!current_user_can('activate_plugins')) {
/* these don't seem to be working */
remove_meta_box( 'e-dashboard-overview', 'dashboard', 'normal');
unregister_widget('WP_Statistics');
}
}发布于 2019-01-17 18:01:38
将操作更改为“wp_dashboard_setup”(而不是“admin_init”)。
Elementor仪表板的代码是正确的-我无法回答站点统计数据。
https://stackoverflow.com/questions/53286968
复制相似问题