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

Auto redirect after session expire, but only for one user

In functions.php add:

<?php

function ps_redirect_after_logout(){
     // get the current user's id
     $current_user_id = get_current_user_id();
     // Get Paul
     $paul = get_user_by('login', 'Paul');
     $paulsid = $paul->ID;
     // check if current user is Paul
     if($current_user_id == $paulsid) {

         wp_redirect('https://www.example.club/logout-page/');
         exit();
         
     }
}
add_action('wp_logout','ps_redirect_after_logout');

I haven’t tested this code, but something like this should be the way to go.

Related Posts:

  1. WordPress custom login page
  2. Custom ReCaptcha Login
  3. How to override wp-login.php
  4. Custom Login and Registration form in Ajax
  5. Properly customizing login/register form
  6. Add Custom API Call to WP-Login.php
  7. Auto login from custom registration form
  8. Deep customization of wp-login.php
  9. Custom Login Process
  10. A truely custom login page?
  11. How to create a custom WordPress front page
  12. Open login logo URL in new tab
  13. No plugin populate user information in to form
  14. Custom password set/reset link in same URL format as default does’t work
  15. Change the default WordPress image on the dashboard login to a custom image [duplicate]
  16. Use wp_login_form function to login with a custom user table?
  17. how to manage Session in WordPress using custom login?
  18. Looking for a way to align log in form fields with background image and scale responsively
  19. Why do I get the timeout warning?
  20. Backup the Database and Restore from the Backup?
  21. Scaling a WP eCommerce site
  22. Looking for a lightweight theme using WP3 new tags and features (not 2010) [closed]
  23. What is the best way to customise admin files so they survive future upgrades?
  24. Verify nonce in REST API?
  25. Add custom html to last sub-menu item
  26. Limit Media Library to Given Folder
  27. How can I get posts in a subcategory to display on it’s parent categories archive page?
  28. Creating my own Admin Forms in a WordPress CMS?
  29. difference between esc_attr(), strip_slashes(), strip_tags()?
  30. Custom taxonomy: same terms, but for different years
  31. customize_register with Multiple controls/settings – how to get values?
  32. Best practices for A/B testing?
  33. Editing the Number at the end of Page URLs / Editing Page Slugs
  34. Automatic image renaming based on title
  35. Manipulating post meta in the customizer
  36. Rearrange elements outputted by comment_form()
  37. Integrating the WordPress admin panel with a frontend theme
  38. generate unique number when registering a user
  39. Looking to display non-image files in Gallery with logo specific to file type
  40. simple wp_insert_post example
  41. Redirect members to custom page upon logging in through WP admin
  42. Can I use $wpdb for my custom tables in the WordPress database?
  43. How to get input_attrs in the sanitize function?
  44. Php custom query function assistance
  45. Integrating MailChimp newsletters as post
  46. How can I manage my multiple wordpress websites from main website?
  47. How to set default values for options page
  48. Is it ok to not a have child theme and just create a theme from scratch?
  49. What is WordPress file encoding?
  50. Change from /wp-admin/ to something else?
  51. WP_Query with the “offset” argument
  52. Adding “Interesting Tags” & “Ignored Tags” like StackOverflow.com in a WordPress Blog?
  53. Auto add taxonomy if post has category
  54. Add a containing DIV to core Gutenberg blocks
  55. How do I deque the default stylesheet?
  56. How to Remove Subscribers from the Post Author Drop Down
  57. Allow comments without approval for custom content type
  58. Add ‘Right Now’ widget to custom dashboard
  59. Are there any security issues with setting the WP_INSTALLING constant to true?
  60. Naming script handles right way
  61. Why would switch_to_blog stop working?
  62. How to add classes in the wp_list_category parent link
  63. How to edit pages after installing WP
  64. Exclude custom taxonomy tag from loop
  65. User Roles Not Sticking
  66. Login form in popup
  67. Replace “WordPress” word in title of Dashboard
  68. $wp_customize->remove_section for customizer setting?
  69. Multiple WordPress outside wordPress installation?
  70. How to remove query string from static resource in WordPress?
  71. WordPress generated links – menus and home_url() – not using https despite settings
  72. Search a post using the date it was posted
  73. Dynamic title in WordPress homepage
  74. Fatal error in wp-admin/customize.php after fresh install due to null $wp_customize
  75. Adding a login form that concatenates three fields into a username
  76. Moving from development while pulling production database without overwriting, to production
  77. Ability to only view (not edit) other user’s personal profile information
  78. Fastest way to get the comment and ping total count for a post
  79. want to create a subcategory.php to manage subcats
  80. Updates for a private theme
  81. Hi, I wanted to make custom search with multiple fields
  82. Is it possible to add a ribbon in the background of h1 on every page?
  83. How to add textarea field to taxonomy (tag)?
  84. Contact From 7 Custom Validation Issues
  85. How to add an extra button on woocommerce shop page and use it to send the product info with image in a mail? [closed]
  86. Control Content On Non-Blog Pages
  87. changing font size and font of a custom message added after comment
  88. education system [closed]
  89. Search widget will search everything in the site, how to limit to only search gallery name
  90. How Can I Move Data From Form 1 To Form 2
  91. Custom wp-content and upload directory
  92. custom post type – page template
  93. How to add custom control to a page?
  94. Navigation label for page in custom theme
  95. How to get Related Custom Posts?
  96. Background image not appearing
  97. Lost password empty field error redirect to custom login
  98. Custom comments list, right depth
  99. Order posts with a custom field but also without
  100. How to hook up search results page to a back-end page?
Categories customization Tags customization, logout, wp-login-form
How to use get_theme_mod in gutenberg editor wordpress?
How to create button to direct to certain category

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