I have added custome page '/member-logout/' in nav walker for user logout. When activated then the function 'render-logout' is fired function render_logout() { if ( is_user_logged_in() ){ wp_logout(); } else { echo "You are not logged-in">'; } } the logout works but generates a lot of warnigns of Warning: Cannot modify header information - headers already sent by (output started at /home/........./formatting.php:5081) in /home/s..../wp-includes/pluggable.php on line 915 and redirect after logout does not work public function redirect_after_logout() { $redirect_url = home_url( 'member-login' ); wp_redirect( $redirect_url ); exit; } add_action( 'wp_logout', 'redirect_after_logout' ); The link below works very well but this is not loaded automaticly. <a href="<?php echo wp_logout_url( home_url() ); ?>" title="Logout">Logout</a> Any idea how to run this link using wp_redirect or something similar?