Site icon Hip-Hop Website Design and Development

wp_logout downside

I’ve added customized web page ‘/member-logout/’ in nav walker for person logout.
When activated then the perform ‘render-logout’ is fired

perform render_logout() {
    if ( is_user_logged_in() ){
         wp_logout();
    } else {
        echo "You aren't logged-in"; 
    }
}

the logout works however generates a number of warnigns of

Warning: Can not modify header data – headers already despatched by
(output began at /house/………/formatting.php:5081) in
/house/s…./wp-includes/pluggable.php on line 915

and that i can not discover what’s at fault

however redirect after logout doesn’t work

    public perform redirect_after_logout() {
    $redirect_url = home_url( 'member-login' );
    wp_redirect( $redirect_url );
    exit;
}
add_action( 'wp_logout', 'redirect_after_logout' );

The logout hyperlink beneath works very properly (no warnings) however this isn’t loaded automaticly.

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

Any concept the best way to run this hyperlink utilizing wp_redirect or one thing related?