Skip to content
Read For Learn
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP
Read For Learn
  • Database
    • Oracle
    • SQL
  • C
  • C++
  • Java
  • Java Script
  • jQuery
  • PHP

How to set where user is redirected to after logging in at wp-login?

Filter 'login_redirect'.

Sample code, not tested:

add_filter( 'wp_login', 'wpse_78150_login_redirect' );

function wpse_78150_login_redirect( $url )
{
    # uncomment the next line for debugging
    # var_dump( wp_get_current_user() ); exit;

    if ( ! current_user_can( 'custom_role' ) )
        return $url;

    return admin_url();
}

Related Posts:

  1. How to check if a user is in a specific role?
  2. Unable to login and wp-login.php redirects to wp-admin%2F&reauth=1?
  3. How to prevent access to wp-admin for certain user roles?
  4. Check if user is admin by user ID
  5. Change Login URL Without Plugin
  6. Only allow administrators and editors to access wp-admin
  7. create users to site with specific language
  8. Prevent from deleting any user role but subscriber
  9. What is the capability that permits access to WP-Admin?
  10. Displaying which Role the current user is assigned to
  11. How to hide a specific user role option in a user role list?
  12. Adding HTML/Text to Top of Subscriber’s Profile Backend Page
  13. Replace wordpress login logo with custom text
  14. Using /wp-admin works, using /login gives a 404. Why?
  15. Custom role based users are not able to access wp-admin
  16. Custom roles showing HTML entities in title form field
  17. Users Unable to Access Dashboard/Posts/Pages
  18. Only allow administrators and editors to access wp-admin
  19. FORCE_SSL_ADMIN not working
  20. Allow administrators to pick post author on custom post type edit screen
  21. Adding Custom Capabilites
  22. Restrict Author role to only 3 wp-admin pages
  23. Use Password Protected Form without the use of wp-login.php
  24. wp-admin – 404 after custom login form
  25. Why is unfiltered_upload not working despite being enabled?
  26. How to fix ‘WordPress redirection loop problem in wp-login.php page’?
  27. Logout USER form backoffice after 30 minutes of inactivity [closed]
  28. WordPress server change – slow admin login time for first time
  29. White screen of death for wp-admin and error for wp-login.php after entering credentials
  30. Blank page for wp-admin after i uploaded the website from my localhost to the live server
  31. Downgrade admin account by mistake
  32. Why can I log into wp-login.php and not wp-admin.php?
  33. Disable Admin CP authentication (or auto login)
  34. User Capabilities are not available in WP REST permission callback?
  35. Change users.php WP_User_Query
  36. User Roles: How to hide a plugin from showing in WP-Admin?
  37. Is WordPress secure enough for a multi-user article directory?
  38. Newly created user role not displaying on users screen
  39. When i try to open Localhost/wordpress/wp-admin . An Error appears ” Registration Has been Disabled” . No login page is shown in the browser
  40. How to check if a user is in a specific role?
  41. Give wp-admin access for shop managers
  42. adding existing menu page on new customer user role
  43. Launch wordpress site to local computer from live website backed-up
  44. Extend user search in the users.php page to allow for searching by role and excluding specified email domains from the “users search” input box
  45. Custom login form logo not displaying
  46. how to Hide all products except the General Manager role in the WordPress admin panel?
  47. WordPress site shows a white page for site/wp_admin. A login returns again to the login screen
  48. Unable to login or reset password via wp-admin
  49. login_enqueue_scripts changes are not reflecting
  50. adding the category to the admin column for a custom post type?
  51. Change page title in admin area
  52. How to filter by post-format in admin?
  53. Make fonts.com font work in TinyMCE (iframe referrer issue)
  54. Securing wp-admin folder – Purpose? Importance?
  55. Opening specific posts on WP takes lot of time and freezes the editor
  56. How to load a CSS file into WordPress admin area using Child Theme? [closed]
  57. Getting “Cannot modify header information – headers already sent” error, but only on backend
  58. Cookie value cannot be read until I’ve logged into the WP admin
  59. How to inhibit dashboard and profile management access to normal users?
  60. What corrections does this code need?
  61. How to add wordpress blog to Windows 2008 R2 site
  62. WordPress disable ‘Install Themes’ tab
  63. WordPress Admin Not Loading All Core Scripts
  64. The uploaded file exceeds!
  65. Admin table list API?
  66. How to change user admin_color with WP CLI?
  67. WP Admin/ WP Login Redirect to themselves
  68. Unable to log in to localhost wp-admin page on XAMPP server
  69. Missing ‘Move to Trash’ option from bulk select box
  70. post-new.php?post_type=product is not loading properly
  71. Renaming wp-admin without hard-coding it. Is it really possible?
  72. Change admin defaults for reading settings
  73. How to hide Admin Tabs? [duplicate]
  74. Admin login not working
  75. Restrict admin access to certain pages based on page slug
  76. Available resources for learning WordPress 4.7.2 from the ground up?
  77. Create new user from phpMyAdmin
  78. how to stop wordpress admin menu from scrolling with page
  79. How to have WP admin in English while public website is in another language?
  80. How to access wp-admin from original website after setting the domain redirect/forwarding
  81. Remove “Filter” Button on All Posts in wp-admin
  82. Unable to login after registration
  83. How can I fix, Sorry, you are not allowed to access this page. I have tried the usual
  84. only last option from theme options is being saved to the DB
  85. wp-login.php entering password nothing happens
  86. Cached php? Updates are rendering only if logged as admin
  87. Symlinking WordPress WP-ADMIN and WP-INCLUDES
  88. I cannot access my WP website after changing settings
  89. Making WP Admin Folder accessable JUST under a different link
  90. Is it possible to load an admin page inside a thickbox?
  91. Why would running an admin check throw a 500 error? I’m calling is_super_admin();
  92. I am not able to enable jQuery in theme settings
  93. WordPress loop in post admin view
  94. How to restrict user to see his comments only and admin can see everyone comments?
  95. theme injecting css into wp-admin
  96. Redirection to external site on admin
  97. WP-Admin not reachable
  98. How Can I Prevent Admin User Role Loss?
  99. Only Admin receives email
  100. Admin utility classes?
Categories wp-admin Tags user-roles, wp-admin, wp-login-form
Add a jQuery Function
Video playing from featured image?

Recommended Hostings

Cloudways: Realize Your Website's Potential With Flexible & Affordable Hosting. 24/7/365 Support, Managed Security, Automated Backups, and 24/7 Real-time Monitoring.

FastComet: Fast SSD Hosting, Free Migration, Hack-Free Security, 24/7 Super Fast Support, 45 Day Money Back Guarantee.

Recent Added Topics

  • Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • Get the name of the template/*html file used
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
  • How to display the description of a custom post type in the dashboard?
  • Critical error on image display
  • Copying WP data and files into new install?
  • How to determine the DirectAdmin WordPress backup date?
  • How to get list of ALL tables in the database?
© 2026 Read For Learn
  • Database
    • Oracle
    • SQL
  • algorithm
  • asp.net
  • assembly
  • binary
  • c#
  • Git
  • hex
  • HTML
  • iOS
  • language angnostic
  • math
  • matlab
  • Tips & Trick
  • Tools
  • windows
  • C
  • C++
  • Java
  • javascript
  • Python
  • R
  • Java Script
  • jQuery
  • PHP
  • WordPress