In order to replace the default WordPress dashboard, you have to redirect to another admin URL in case a user tries to access it.
In the example below we redirect the users to the posts table and the URL is edit.php
. Change it with the one that you want.
Add the function below in order to redirect the user after login:
//redirect users after login to wp-admin
function ik_redirect_dashboard_after_login( $redirect_to, $request, $user ){
$redirect_to = admin_url( 'edit.php' );
return $redirect_to;
}
add_filter( 'login_redirect', 'ik_redirect_dashboard_after_login', 9999, 3 );
PHPAdd the function below in order to redirect all the requests from wp-admin/index.php
to wp-admin/edit.php
:
// redirect all the dashboard requests
function ik_redirect_dashboard(){
wp_redirect( admin_url( 'edit.php' ) );
}
add_action( 'load-index.php', 'ik_redirect_dashboard' );
PHP