Hi @dryn07, glad you’re here!
Would you please elaborate on what you’re trying to achieve with the instant logout behavior? Are you trying to put a custom menu that instantly logs out your users when they click it?
If so, the default WP logout link looks like this: https://site.com/wp-login.php?&loggedout=true.
But if you enabled Solid Security’s Hide Backend feature, the logout link will look like this: https://site.com/wp-login.php?itsec-hb-token=wplogin&loggedout=true (replace “wplogin” with your HBE slug)
Please let me know if this helps.
Thread Starter
dryn07
(@dryn07)
Both solutions are what I was looking for, thank you. However, this is only a partial solution; my goal would be to have the user redirected to the homepage upon logout (without using an additional plugin). Is there perhaps any solution for this?
Hi @dryn07, sorry for the slow turnaround here!
Your goal to redirect users to the homepage upon logout should be achievable even with the HBE enabled by creating a custom function utilizing the wp_logout hook.
Here’s a simplified version of the redirect behavior:
function redirect_to_homepage_after_logout() {
wp_redirect(home_url()); // Redirect to homepage
exit();
}
add_action('wp_logout', 'redirect_to_homepage_after_logout');
You’ll need to add your custom code to your theme’s functions.php file (preferably in the child theme) or by using a code snippet plugin.
Hope this helps!