Solution to WordPress background logon without redirection

Source: Internet
Author: User
Tags setcookie

I thought it was the reason for the speed of the network. Later I found out why on the Internet, not that you didn't log on to the WordPress background, it may be because you have used some plug-ins or the FSO of the space server.
To solve this Wordpress background login problem, in fact, very simple, is to enter [your domain name]/wp-login.php, not the general use of the [your domain name]/wp-admin /,

For example, this site:/wp-login.php. You can log on.

The above is the simplest method. If you are not used to it, you can change the code.
The details are as follows:

Open the file/wp-uplodes/pluggable. php

The code is as follows: Copy code

Search

Setcookie ($ auth_cookie_name, $ auth_cookie, $ expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $ secure, true );

Change

Setcookie ($ auth_cookie_name, $ auth_cookie, $ expire, SITECOOKIEPATH, COOKIE_DOMAIN, $ secure, true );

In this way, you can log on directly with/wp-admin.


Redirection after login

During the login process of wordpress, after the verification is passed, the wordpress system will jump directly to the background management page of the website by default! Then we can modify the jump page of the login website based on the powerful wordpress hook. For example, the following is the code in the official document, which enables the user to jump to the page based on the user name during login:

 

The code is as follows: Copy code
<? Php
Function my_login_redirect ($ redirect_to, $ request, $ user ){
// Verify the user
If (is_array ($ user-> roles )){
// Verify the Super Administrator
If (in_array ("administrator", $ user-> roles )){
// If the super administrator is present, return to the background management homepage.
Return home_url ('/wp-admin /');
} Else {
// Otherwise, go to the homepage of the website
Return home_url ();
       }
    }
}
Add_filter ("login_redirect", "my_login_redirect", 10, 3 );
 
?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.