1. Home
  2. Knowledge Base
  3. Customization
  4. Redirect users to the map after login

Redirect users to the map after login

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.

Problem

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
function oum_redirect_all_users_after_login($redirect_to, $request, $user) {
    return home_url('/'); // replace / with the desired URL
}
add_filter('login_redirect', 'oum_redirect_all_users_after_login', 10, 3);
Was this article helpful?

Related Articles

Contents

Need Support?

Can't find the answer you're looking for?
Contact Support

EN