即使我从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>\';
}
}
}
最合适的回答,由SO网友:vancoder 整理而成
你不应该直接从你的函数中呼应任何东西。php。这样做将阻止重定向。
去掉第226行,你就可以走了。您可能想用更好的代码(甚至插件)替换整个remove\\u admin\\u栏。