Wp_logout_url($reDirect)不会注销和重定向()

时间:2013-03-27 作者:Toni Michel Caubet

即使我从wp docs

<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>
这是用户单击时的输出:

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-login.php on line 368

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-login.php on line 380

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 697

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 698

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 699

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 700

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 701

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 702

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 705

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 706

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 707

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 708

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 711

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 712

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 713

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 714

Warning: Cannot modify header information - headers already sent by (output started at /usr/home/nakashitabcn.com/web/pedidos/wp-content/themes/nakashita/functions.php:226) in /usr/home/nakashitabcn.com/web/pedidos/wp-includes/pluggable.php on line 876
作为URL类似于:

http://website.com/pedidos/wp-login.php?action=logout&redirect_to=http%3A%2F%2Fwebsite.com%2Fpedidos%2F&_wpnonce=db999bfbcb
-编辑-

function remove_admin_bar() {
    global $wp_admin_bar;
    if (is_user_logged_in()) {
        if (!current_user_can(\'administrator\') && !is_admin()) {
          show_admin_bar(false);
/* LINE 226*/         echo \'<style>#background{top:-28px}</style>\';
        }

    }
}

1 个回复
最合适的回答,由SO网友:vancoder 整理而成

你不应该直接从你的函数中呼应任何东西。php。这样做将阻止重定向。

去掉第226行,你就可以走了。您可能想用更好的代码(甚至插件)替换整个remove\\u admin\\u栏。

结束

相关推荐

Logout redirects to /forums/

不久前,我安装了一个插件,在注销时,它会将用户重新定向到/forums/.不幸的是,我不知道那是哪个插件,也不知道它是否仍然处于活动/安装状态。我可以查找哪些代码/数据库设置来删除有问题的代码?提前感谢,