1. Accueil
  2. Base de connaissances
  3. Personnalisation
  4. Rediriger les utilisateurs vers la carte après la connexion

Rediriger les utilisateurs vers la carte après la connexion

If you are using the Restrict „Add location“ to logged in users only feature or generally accept location proposals from registered users this might help to improve the user experience.

Problème

By default, WordPress redirects users to their profile page after login. This looks ugly and is part of the WordPress admin dashboard. In most cases, it doesn’t make sense for users to land here right after successfully logging in.

Solution

Simply add the following PHP code to your theme’s functions.php file (or via the Code Snippets plugin). It will redirect the user to a page of your choice (e.g. the map page) instead of dropping them on their profile page.

PHP
fonction oum_redirect_all_users_after_login($redirect_to, $request, $user) {
    retour home_url('/'); // replace / with the desired URL
}
ajouter_filtre('login_redirect', 'oum_redirect_all_users_after_login', 10, 3);
Cet article vous a-t-il été utile ?

Articles connexes

Besoin d'aide ?

Vous ne trouvez pas la réponse que vous cherchez ?
Contact Support

FR