Last active
October 29, 2017 06:29
-
-
Save zevilz/9b58c39734256283479379c36bf9f687 to your computer and use it in GitHub Desktop.
Hide dashboard in Wordpress
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Hide dashboard page from admin menu | |
* | |
*/ | |
function remove_menus() { | |
remove_menu_page('index.php'); | |
} | |
add_action('admin_menu', 'remove_menus'); | |
/* | |
* | |
* Redirect from dashboard to pages list | |
* | |
*/ | |
function dashboard_redirect() { | |
wp_redirect(admin_url('edit.php?post_type=page')); | |
} | |
add_action('load-index.php','dashboard_redirect'); | |
/* | |
* | |
* Redirect to pages list after login | |
* | |
*/ | |
function login_redirect($redirect_to, $request, $user) { | |
return admin_url('edit.php?post_type=page'); | |
} | |
add_filter('login_redirect', 'login_redirect', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment