I'm creating a customized wordpress theme based on an existing site.
I want to use an alternate dashboard which I have created.
How can I have the user directed to 'news.php
' after login instead of '/wp-admin/
' ?
--
EDIT: Have a working Plug-in for this but the bounty is still availible for anyone who can find a manual way to do this through functions.php, as it would be more secure then using a 3rd party plug-in.
Please try this, it works for any redirection on wordpress
To globally redirect after successful login, find this code in wp-login.php, under section.
and replace
<?php echo esc_attr($redirect_to); ?>
with your URL where you want to redirect. The URL must start with http:// and ends on /other wise page redirect to default location.Do same thing form redirect after registration with in same file but under
<form name="registerform">
section.The accepted answer is very wrong. One should never be modifying the WordPress Core. Not only will edits be lost at a given update, some changes you make on a whim may compromise other functionality or even endanger the security of your site.
Action Hooks & Filters are included within the core to allow modifying functionality without modifying code.
An example of using the
login_redirect
filter to redirect certain users can be found here and is a much more robust solution to your problem.For your specific problem, you want to do this:
This may help. Peter's Login Redirect
If you have php 5.3+, you can use an anonymous function like so: