0

Even that I got the code from the wp docs

<a href="<?php echo wp_logout_url( get_permalink() ); ?>" title="Logout">Logout</a>

This is the output when user clicks on it:

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

Being the URL something like:

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

-EDIT-

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
    And what is at line 226 of your functions.php? – vancoder Mar 27 '13 at 17:16
  • Edited with it, any idea? – Toni Michel Caubet Mar 27 '13 at 17:59
1

You shouldn't be echoing anything directly from your functions.php. Doing so will prevent redirects.

Remove line 226 and you should be good to go. You might want to replace that whole remove_admin_bar with something better coded (or a plugin even).

  • So what's the best place to check if user is logged in (and not an admin) to apply those styles? (or can it be done using ob_start?) Thanks! – Toni Michel Caubet Mar 27 '13 at 19:21
  • You should only need this: if ( ! current_user_can( 'manage_options' ) ) { show_admin_bar( false ); } – vancoder Mar 27 '13 at 19:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.