forked from vincentorback/clean-wordpress-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
45 lines (37 loc) · 1.04 KB
/
dashboard.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
/**
* Removing dashboard widgets.
*
* @link https://developer.wordpress.org/reference/functions/remove_meta_box/
*/
add_action(
'admin_init',
function () {
// Remove the 'Welcome' panel
remove_action( 'welcome_panel', 'wp_welcome_panel' );
// Remove 'Site health' metabox
remove_meta_box( 'dashboard_site_health', 'dashboard', 'normal' );
// Remove the 'At a Glance' metabox
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
// Remove the 'Activity' metabox
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
// Remove the 'WordPress News' metabox
remove_meta_box( 'dashboard_primary', 'dashboard', 'side' );
// Remove the 'Quick Draft' metabox
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
}
);
/**
* Remove access to the dashboard
*/
add_action(
'admin_init',
function () {
global $pagenow; // Get current page
$redirect = get_admin_url( null, 'edit.php' ); // Where to redirect
if ( $pagenow == 'index.php' ) {
wp_redirect( $redirect, 301 );
exit;
}
}
);