最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Wordpress wp-admin redirect and exception

programmeradmin0浏览0评论

Wordpress website keeps on redirecting to login page after I enter correct login credentials. When I input the wrong credentials, it shows an error stating that the credentials are not correct. So I enabled the debug mode to see what appears as the error message and the following errors are being produced whenever I try to access wp-admin with debug mode enabled. When I disable debug mode, the login page does appear.

Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php on line 833

Warning: Cannot modify header information - headers already sent by (output started at /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php:833) in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-includes/pluggable.php on line 1265

Warning: Cannot modify header information - headers already sent by (output started at /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php:833) in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-includes/pluggable.php on line 1268 ```

Wordpress website keeps on redirecting to login page after I enter correct login credentials. When I input the wrong credentials, it shows an error stating that the credentials are not correct. So I enabled the debug mode to see what appears as the error message and the following errors are being produced whenever I try to access wp-admin with debug mode enabled. When I disable debug mode, the login page does appear.

Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php on line 833

Warning: Cannot modify header information - headers already sent by (output started at /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php:833) in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-includes/pluggable.php on line 1265

Warning: Cannot modify header information - headers already sent by (output started at /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-content/plugins/anps_theme_plugin/plugin-updates/plugin-update-checker.php:833) in /xd1/homes/hash/22/80/a28022/88/82/u108288/XXX.co.zw/www/wp-includes/pluggable.php on line 1268 ```
Share Improve this question asked Jan 6, 2021 at 12:19 Wesley MarimaWesley Marima 1 1
  • It is just a deprecation warning and should not change if you can login or not. Did you try deactivating the anps_theme_plugin plugin and trying again? – kero Commented Jan 6, 2021 at 13:16
Add a comment  | 

1 Answer 1

Reset to default 1

The plugin update checker is outputting something before the login redirection. The function wp_redirect() has to be called before anything gets echoed onto the screen. Try disabling the anps_theme_plugin and see if your login problem resolves.

Edit: I use a more complicated logging system that prints out nice and pretty on a custom admin page, but here is a temporary hack to the function wp_redirect() in pluggable.php This will stop execution immediately upon the error and tell you the last ten functions leading up to it. That backtrace will be an array.

The first and last lines are untouched, so you can see their location.

$x_redirect_by = apply_filters( 'x_redirect_by', $x_redirect_by, $status, $location );
    if ( is_string( $x_redirect_by ) ) {
        if (! headers_sent($filename, $linenum)){
            header( "X-Redirect-By: $x_redirect_by" );
        } else {
            $backtrace = debug_backtrace(FALSE, 10);
            echo '<br><br><br><pre>';
            print_r($backtrace);
            wp_die();
        }
    }
    if (! headers_sent($filename, $linenum)){
      header( "Location: $location", true, $status );
    } else {
        $backtrace = debug_backtrace(FALSE, 10);
        echo '<br><br><br><pre>';
        print_r($backtrace);
        wp_die();
        }

    return true;
发布评论

评论列表(0)

  1. 暂无评论