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

Redirect users by role to custom pages

For redirect you can do something like this.

function redirect_to_page() {
    global $user;

    if (in_array( 'specified_role', $user->roles ) ) {
        return '/wp-admin/post.php?post=7&action=edit';
    }
}

add_filter('login_redirect', 'redirect_to_page');

Related Posts:

  1. How can I display Custom Post type Custom Columns and its Content in a Dashboard Widget?
  2. Creating plugin with front-end pages
  3. How to find error in my code when the error message is pointing to WP core file?
  4. How to select the contents in the text view textrea in wp_editor?
  5. How to access global variable $menu inside a class function
  6. Wp-login appears White Screen, Error: Cannot modify header information
  7. Hide categories that are not used in the post type
  8. Automated Cart Update With Alert Box Each Time
  9. How can I remove a function that has been added to wordpress with add_filter?
  10. remove wp floating submenu in wp dashboard
  11. PHP Fatal error: Uncaught mysqli_sql_exception: Table doesn’t exist in wordpress/wp-includes/wp-db.php
  12. WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
  13. How to sanitize any integer input field in wordpress?
  14. How to set up VS Code for WP plugin/theme development in 2021? [closed]
  15. WordPress ajax doesn’t display object method on jQuery .change() function
  16. Custom user login page by creating a plugin
  17. Singelton class does not work, multiple initialization on page reload
  18. Saving an array of dynamic repeater data as post_meta
  19. what is the best practice to add new field to an api route
  20. filter default query to show just selected level of child pages in wordpress
  21. Retrieve $_POST data submitted from external URL in WordPress(NOT API)
  22. WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
  23. How to upload a file to a folder named after the user_id via plugin
  24. Reprinting tags with all attributes
  25. Cannot access wp-admin (wordpress dashboard)
  26. Use custom post type for a store locator
  27. developing a wordpress plugin, have a few PHP Woocommerce related coding questions
  28. Improve page speed loading using CDN and async or defer attribute
  29. Dashboard broken into list of links
  30. How do I programmatically set a user as spam in BuddyPress? [closed]
  31. How to use $_GET function WordPress backend
  32. Whitelisting items from custom options page
  33. Add_menu_page not displaying the menu in class based plugin
  34. How to call plugin function per site in a multisite?
  35. Update results, Before deleting the related category [closed]
  36. How to make my custom widget appear within WordPress widgets? Plugin development
  37. Script to browser problem PHP
  38. adjust section according to country?
  39. How to auto fetch customer details in Woocommerce in checkout page
  40. Can’t upload image using media_sideload_image
  41. WordPress admin pointers tour bug?
  42. Store a default value for a transient on plugin activation
  43. Adding widgets to my plugin page instead of WordPress dashboard
  44. WP CRON duplicate wp_insert_post with has < and > tag
  45. How wp-cron can run in background if PHP is single threaded?
  46. How to insert data into database using wp cron job
  47. How to send Ajax request from my plugin in admin dashboard?
  48. I want to add custom add to cart link [closed]
  49. Options API get_option() and update_option() Not Correctly Updating or Returning
  50. Execute long and heavy processes
  51. wp_head function not outputting
  52. wp query foreach deleting record returning only first or last item
  53. Extend PHP regex to cover “srcset” and “style” attributes
  54. Adding function to Genesis genesis_header [closed]
  55. AJAX success response is not working but it’s saving my changes
  56. Access Child Class of Plugin Main Class Instance
  57. PHP > Scheduled Tasks > Sending daily email with dynamic API variables
  58. How to make own crop image function for WordPress plugin
  59. WordPress Custom field Colors
  60. Best practice for show data to one specific user?
  61. How can I hide that I Use WordPress (with W3 Total Cache)
  62. how to update and display an option without reloading the page
  63. Font Awesome changing default WordPress Font
  64. Saving plugin settings – ERROR: options page not found
  65. Custom plugin settings link doesn’t append current class to menu item when visited? Why?
  66. class_exists returns different values [closed]
  67. “Undefined index” error when saving empty array with checkboxes
  68. Can’t print Yoast meta description into page template (syntax error, unexpected ‘.’) [closed]
  69. Download full html page with CSV export plugin
  70. How to obtain the current website URL in my theme?
  71. What exactly do this function declared into functions.php file of a WP theme?
  72. Asynchronous multiple requests 401 Unauthorized
  73. How to use html inside a functions.php code?
  74. Custom array from a query only write the last row of the query
  75. How to hook code to show after the_content?
  76. Plugin Generate Unexpected output during activation
  77. WordPress Environment: Dynamic Page using shortcode – how to change the page name for sharing
  78. Extend Woocommerce Widget Class – WC_Widget_Product_Categories
  79. Undefined method class::construct() when creating a plugin
  80. Using and saving custom dropdown boxes on user profiles
  81. Hook called before text widget save
  82. plugin add action hook is not working :
  83. wp_insert_post: array only. wp_update_post: array|object (?)
  84. Using data sent via AJAX in multiple functions on a WP plugin
  85. Problem with AJAX in wordpress plugin
  86. Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
  87. Is it save to use eval for a jQuery callback method coming from the database?
  88. What does -> mean in WordPress?
  89. zip unzip attachments in wordpress
  90. wpdb prepare insert table doesn’t work
  91. wordpress admin plugin menu custom css
  92. Usage of call back function of add_meta_box()
  93. Building a REST API for your web app exposes primary keys of DB records?
  94. Change product_base programmatically
  95. Scheduling an event inside plugin class is not working
  96. How to remove the message ‘We could not find any results for your search’ without changing template files and without adding posts/pages?
  97. how to prevent wordpress admin from logging in via woocommerce my-account page
  98. How to add the sidebar to all the pages except the home page? [closed]
  99. Custom meta box values are not getting saved for my custom post type
  100. How to hook a logout funtion for specific usr role in wordpress?
Categories PHP Tags dashboard, php, plugin-development, wp-login-form
Images as Categories
Query only past events and only future events in the event calendar

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