forked from ouun/clean-wordpress-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdashboard.php
51 lines (38 loc) · 1.46 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
46
47
48
49
50
51
<?php
/**
* Removing dashboard widgets.
* @link https://codex.wordpress.org/Function_Reference/remove_meta_box
*/
add_action( 'admin_init', function () {
// Remove the 'Welcome' panel
remove_action('welcome_panel', 'wp_welcome_panel');
// Remove the 'incoming links' metabox
remove_meta_box( 'dashboard_incoming_links', 'dashboard', 'normal' );
// Remove the 'plugins' metabox
remove_meta_box( 'dashboard_plugins', 'dashboard', 'normal' );
// Remove the 'WordPress News' metabox
remove_meta_box( 'dashboard_primary', 'dashboard', 'normal' );
// Remove the secondary metabox
remove_meta_box( 'dashboard_secondary', 'dashboard', 'normal' );
// Remove the 'Quick Draft' metabox
remove_meta_box( 'dashboard_quick_press', 'dashboard', 'side' );
// Remove the 'Recent Drafts' metabox
remove_meta_box( 'dashboard_recent_drafts', 'dashboard', 'side' );
// Remove the 'Activity' metabox
remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
// Remove the 'At a Glance' metabox
remove_meta_box( 'dashboard_right_now', 'dashboard', 'normal' );
// Remove the 'Activity' metabox (since 3.8)
remove_meta_box( 'dashboard_activity', 'dashboard', 'normal' );
});
/**
* 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;
}
});