admin管理员组

文章数量:1323335

My development computer recently had to be rebuilt so I am now trying to migrate a WordPress site from the hosting company to my development PC. So far I have done this:

  1. Installed XAMPP.

  2. Download the PHP files using FTP and put them in htdocs\mysite

  3. Create a virtual host called: localhost.MySite.

  4. Export the .sql from the host using PHPMyAdmin

  5. Open the .sql and to a find and replace replacing: www.mysite.co.uk with: localhost.MySite

  6. Use PHPMyAdmin on my local PC to load the .sql

  7. Make changes to wp_config.php:

    define('WP_HOME', 'http://localhost/mysite');
    define('WP_SITEURL', 'http://localhost/mysite');
    

Everything appeared to work e.g. the multi sites; the admin panel etc. The only issue I have is when I logout of the admin panel; I am redirected to: /?loggedout=true instead of: http://localhost.MySite/wp-login.php/?loggedout=true. What can I do?

I have spent a while Googling this e.g. I have looked here: /

This issue does not happen on the live website.

Update

I only appear to have theis issue on the root site of the multi site.

My development computer recently had to be rebuilt so I am now trying to migrate a WordPress site from the hosting company to my development PC. So far I have done this:

  1. Installed XAMPP.

  2. Download the PHP files using FTP and put them in htdocs\mysite

  3. Create a virtual host called: localhost.MySite.

  4. Export the .sql from the host using PHPMyAdmin

  5. Open the .sql and to a find and replace replacing: www.mysite.co.uk with: localhost.MySite

  6. Use PHPMyAdmin on my local PC to load the .sql

  7. Make changes to wp_config.php:

    define('WP_HOME', 'http://localhost/mysite');
    define('WP_SITEURL', 'http://localhost/mysite');
    

Everything appeared to work e.g. the multi sites; the admin panel etc. The only issue I have is when I logout of the admin panel; I am redirected to: http://wp-login.php/?loggedout=true instead of: http://localhost.MySite/wp-login.php/?loggedout=true. What can I do?

I have spent a while Googling this e.g. I have looked here: https://wordpress/support/topic/logout-redirect-not-working-3/page/2/

This issue does not happen on the live website.

Update

I only appear to have theis issue on the root site of the multi site.

Share Improve this question edited Sep 4, 2020 at 13:33 w0051977 asked Sep 4, 2020 at 11:28 w0051977w0051977 1214 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

I have traced the problem to this code in wp-login.php:

case 'logout' :
    check_admin_referer('log-out');

    $user = wp_get_current_user();

    wp_logout();

    echo "hello";
    echo $_REQUEST['redirect_to'];

    if ( ! empty( $_REQUEST['redirect_to'] ) ) {
        $redirect_to = $requested_redirect_to = $_REQUEST['redirect_to'];
    } else {
        $redirect_to = 'wp-login.php?loggedout=true';
        $requested_redirect_to = '';
    }

It appears if I change this line:

$redirect_to = 'wp-login.php?loggedout=true';

to this:

$redirect_to = 'http://wp-login.php?loggedout=true';

Then it works as expected. Not sure why. In fact I can also change it to any of the following and it still works as expected:

$redirect_to = 'http://';

or

$redirect_to = 'http://somerandomsite';

Not sure what is going on.

本文标签: migrationWhy is the domain name missing from the logout redirect