internet

Redirect your members to the home page of your WordPress blog after they logout

With WordPress, you can create user accounts with different permission levels and provide a connection via the front office of your blog. The user then enters their username and password and validates the connection. Once they will be connected, a logout button that will appears. Click on it and it will redirect the member to the current page but question arises “how it can redirect to the home page or some other desired page as according to you?”

This technique requires the function wp_logout_url that defines the direction in which the visitor is redirected after the disconnection effected (logout). So we need to locate where this function is in the theme.

If the connection system is located in the header, look in the header.php file.

If you are not a developer, the easiest way is often to download the theme to your hard drive then do a search using Windows Explorer or Finder.

Then use the following line of code to redirect to the home page:

<A title = “Logout” href = “<? Php echo wp_logout_url (home_url ());?>”> Logout </ a>

Further, it suffices to indicate the parameter redirection between the parenthesis of the function like this – replacing the $redirect to the URL of your choice:

 <? Wp_logout_url php echo ($ redirect);?>

In this way you can redirect your members to your desired page after they logout.

Leave a Reply

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