Skip to content

Instantly share code, notes, and snippets.

@zevilz
Last active October 29, 2017 06:29
Show Gist options
  • Save zevilz/9b58c39734256283479379c36bf9f687 to your computer and use it in GitHub Desktop.
Save zevilz/9b58c39734256283479379c36bf9f687 to your computer and use it in GitHub Desktop.
Hide dashboard in Wordpress
/*
*
* 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