We have a filter in WordPress for set url to redirect after logout. You can use this filter to redirect back to current page after logout. Add the following code in your theme’s functions.php file..

/* Logout and return to the page they were on*/
function admin_logout_redirect($logouturl, $redir)
    {
        return $logouturl . '&redirect_to=http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
    }
add_filter('logout_url', 'admin_logout_redirect', 10, 2);

Have any doubt, then comment here!

Leave a Reply

Your email address will not be published. Required fields are marked *