One, redirect to the Web Site Administration panel.
Add the following code to the functions.php file for your current topic:
PHP Code 1. function Soi_login_redirect ($redirect _to, $request, $user)
0.9
3. Return (Is_array ($user->roles) && in_array (' Administrator ', $user->roles))? Admin_url (): Site_url ();
4.}
5.add_filter (' Login_redirect ', ' soi_login_redirect ', 10, 3);
Redirect to a specific page or article
You can also redirect users to a specific page with the following code:
PHP Code 1. function Login_redirect ($redirect _to, $request, $user) {
2. Return Home_url (' custom-page ');
3.}
4.add_filter (' Login_redirect ', ' login_redirect ', 10, 3);
Modify Custom-page in code for a page or article link (note: Do not include the site domain name), if deleted custom-page will jump directly to the site home page.
Third, customize the redirect link after logout
PHP Code 1 add_action (' wp_logout ', ' auto_redirect_after_logout ');
2.function Auto_redirect_after_logout () {
3. wp_redirect (Home_url ());
4. exit ();
5.}
to jump to the home page