Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redirect after Login on WordPress

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.

like image 476
Philip Kirkbride Avatar asked Nov 14 '11 20:11

Philip Kirkbride


People also ask

How do I redirect a user to a page after login?

The most common ways to implement redirection logic after login are: using HTTP Referer header. saving the original request in the session. appending original URL to the redirected login URL.

How do I automatically redirect in WordPress?

Go to 'Settings' in the WordPress admin menu and then click on 'Website Redirect'. Enter the URL you want to redirect the site to, set the desired redirection type, set the status to 'Enabled' and save your changes!

How do I stop WordPress login redirecting?

The quickest way to solve the WordPress login redirect issue is by clearing your browser cookies and cache. WordPress uses cookies to store authentication data. Sometimes your browser might retain old files, resulting in a redirect loop when you try to log in to your site.

How do I redirect a WordPress user after registration?

To automatically logged user in (auto-login) and then redirect them to a custom page after registration, go to ProfilePress settings, open the Registration section and then check Auto-login after registration .


1 Answers

This should solve your problem. Adapted from an answer found here.

Add the following snippet of code in the functions.php file of your theme:

function admin_default_page() {   return '/new-dashboard-url'; }  add_filter('login_redirect', 'admin_default_page'); 
like image 70
Travis Avatar answered Sep 29 '22 10:09

Travis