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. Administrator user cannot access dashboard after localwp import
  50. WordPress change role from administrator to author by itself (automatically)
  51. login_enqueue_scripts changes are not reflecting
  52. Organizing Code in your WordPress Theme's functions.php File?
  53. Can I rename the wp-admin folder?
  54. How do I Enqueue styles/scripts on Certain /wp-admin Pages?
  55. Changing Admin Menu Labels
  56. Adding custom columns to custom post types
  57. Adding Fields to the Category, Tag and Custom Taxonomy Edit Screen in the WordPress Admin?
  58. adding custom stylesheet to wp-admin
  59. Can’t change language (only “English (United States)”)
  60. Is there ANY way to remove comments function and section totally?
  61. How to use “menu_order” field for posts?
  62. “Too many redirects” ONLY when trying to access wp-admin page
  63. How to restrict dashboard access to Admins only?
  64. Admin Page Redirect
  65. Disable dragging of meta boxes?
  66. Toggle admin metabox based upon chosen page template
  67. When moving a WP site, why does wp-admin redirect to old site?
  68. How to disable the “Post Lock/Edit Lock”?
  69. adding the category to the admin column for a custom post type?
  70. How can we make managing lots of pages in WordPress Admin better?
  71. Change page title in admin area
  72. do_shortcode() within Admin Page
  73. How can I control the position in the admin menu of items added by plugins?
  74. Changing the ‘wp-admin’ URL to whatever I want
  75. Unit testing in the WordPress backend (is_admin() is true)
  76. Admin ajax request return 0 with die()
  77. How to remove screen options and help links in the admin area?
  78. How to remove the core embed blocks in WordPress 5.6?
  79. How to increase the file size limit for media uploads?
  80. Create WP tutorial for users with admin pointer using next button for navigation
  81. I’m getting a 404 message when I try to access wpadmin
  82. Taxonomy dropdown metabox in the back-end
  83. wordpress wp-admin css not loading
  84. Sort admin menu items
  85. How to order by post meta name in wp admin?
  86. How set defaults on wpLink()
  87. Remove dashboard, use Pages tab as default
  88. How to redirect/rewrite all /wp-login requests
  89. Show all post tags on post edit screen/sidebox
  90. How to hook in and modify the new revisions UI (3.6+)?
  91. How to display a static HTML page while setting up a WordPress site?
  92. Limit widget to certain sidebar?
  93. How can I uninstall a language?
  94. My wordpress site gets redirected automatically to the old site any known solution for this?
  95. Best way to present options for home page in admin?
  96. Use a different domain for SSL
  97. Remove specific items from Quick Edit menu of a Custom Post Type?
  98. How to filter by post-format in admin?
  99. Unable to login to my wordpress site. reauth=1 redirection loop
  100. Add “external” link to admin menu in the backend
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
  • Post Navigation Elementor
  • Custom Elementor controls not appearing in the widget Advanced tab using injection hooks
  • WPFacet multiple loop displaying duplicate content
  • Get the name of the template/*html file used
  • Fix: WordPress.DB.PreparedSQL.NotPrepared Plugin Check (PCP)
  • Removing unnecessary CSS and JS code from wp_head()
  • hexagonal image gallery. Am I on the right track? [closed]
  • Trying to Add Paging to Single Post Page
  • Sharing media files between live and staging servers
© 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