In this short guide, we will cover how to redirect user’s to a specific page when logging out of their WordPress account.
This will require a little bit of copy, pasting and possibly editing the line of code for wp_redirect to the specified URL you would like user’s to be redirected to when logging out of their WordPress account.
Please add this code to your custom WordPress plugin or Code Snippets plugin. You may follow our guide on how to customize WordPress the correct way for a deeper look into adding custom code to your site.
The above code will redirect user’s to the home page on the WordPress logout action (logging out of WordPress) but this can be changed by editing the value inside the wp_redirect
from home_url()
to be home_url( '/some-path' )
or even a hardcoded URL of your site.
Once added, all user’s that logout of WordPress will be redirected to the specified URL.
Photo by Sarah Dorweiler, Evano Community