Hello,
I recently enable a page for log out, but when a user is on a blog article or any specific page and he logs out the user is being redirected back to the current page. I have customised the page I want to use for logout but I want my users to be redirected to that actual logout page I created instead of being redirected back to their current visited page.
Is there a function I can apply in my themes functions.php to deactivate this bl_get_current_page_uri() and redirect to the actual customised logout page with the slug https://site.com/logout/Thanks
Hi Tosin,
1. Please create a new page and assign that to the Logout page setting. This page will not be accessible to the user.
2. Now, you can redirect user to any page on logout
/** * Filter logout url. * * @return string */ function bl_custom_filter_logout_url( $url ) { if ( is_admin() && ! defined( 'DOINGAJAX' ) ) { return $url; } $logout_url = bl_get_logout_link(); if ( empty( $logout_url ) ) { return $url; } $redirect = 'http://yoursite.com/page-xyz/';// change with actual. // $redirect = wp_validate_redirect( $redirect ); if ( $redirect ) { $query['redirect_to'] = $redirect; } $logout_url = add_query_arg( $query, $logout_url ); return $logout_url; } add_filter( 'logout_url', 'bl_custom_filter_logout_url', 100 );
Please change the $redirect with your own url.
Regards
Brajesh
The topic ‘ [Resolved] Branded login support for logout redirect’ is closed to new replies.