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. how do i add logo in my site
  20. I need to make the title of the page dynamic in my custom plugin
  21. How to use same username account for multiple users?
  22. Custom CSS working on home page but not on NEW created PAGE
  23. Set custom banner image size with wp_customize
  24. Show total sales for each products on search results page Woocommerce
  25. I have one page in my WordPress site with a table that needs to be super compact and simple
  26. Post does not disappear
  27. Post interior margin in twenty eleven theme
  28. Redirect all pages to the custom login page except for the registration page
  29. Problems with WP 6.1.1 and the get_user_meta() function
  30. How to stop login for SPECIFIC users BEFORE a specified date
  31. Changes to code not displaying
  32. Woocommerce send custom email receipt based on product attribute
  33. User Query Multiple Orderby Clause
  34. Show last child Child category instead of first child category on page
  35. How to apply filters if editing specific template
  36. Disable all Fonts that are Standard in WordPress and replacing them with a custom Font?
  37. How to search for replacement titles and contents, excluding image URLs
  38. Some data of one custom user profile is erased when I update another custom user profile
  39. Change in credit card payment button for woocommerce
  40. Custom Search on media files PDF images pages posts
  41. Custom Menu (only showing direct cildren) ACF not showing
  42. wordpress categories narrow down results
  43. Is it bad practice to add a filter within a filter in wordpress?
  44. Local WordPress installation feeding multiple online site sites
  45. Modifying posts based on category in TwentyTwentyTwo theme
  46. Permalink Listing WordPress
  47. Redirection after Category Change for Custom Structure
  48. How to display product variations on same row
  49. Has the table name in SQL for WordPress changed from WP_posts to WPCS_post?
  50. Why after customizing Home Page, the site is loading six missing blob sources, slowing down all site?
  51. Multi color post title by using custom javascript inside the gutenberg editor?
  52. Create a page for each database table entries
  53. Add custom styles to the Raft theme
  54. Where did I put this one line of css?
  55. Custom product sorting archive page
  56. Add custom information in editor summary
  57. A Voting system for a pageants
  58. Add line break for menu items
  59. How do I know if the custom theme is a child theme or a full-custom theme?
  60. How can I get the Media Library backend to show larger thumbnails?
  61. Import bootstrap 5 and bootstrap icons in wp-admin backend
  62. wp_login_form display no styled form
  63. I want to force secondary rows using WP_List_Table
  64. Customise “Add a New Post” page
  65. Must I rewrite the whole login form or can I jsut do a part
  66. Hover Hide-Visible Additional CSS not working in WordPress website, but shows properly in Customize window
  67. Add a custom field for sorting the products in a specific category WOOCOMMERCE – Second try
  68. Add a custom field for sorting the products in a specific category WOOCOMMERCE
  69. Advanced Custom Fields in WP_Query: Href Returning Empty
  70. woocommerce, add free sample button on product page
  71. RSS Feed Customization
  72. How to increase page title font size in twenty seventeen wordpress theme for static home page and single column option
  73. Display Published Posts Count for Time Period
  74. How to create a second Super Admin or Super User via MySQL DB
  75. Can’t change WordPress / WooCommerce attribute value order
  76. How to move custom icons from parent theme to the child theme
  77. Mobile version displaying all wrong after custom theme rewrites
  78. Taxonomy question how to add more data
  79. Different titles on homepage vs single based on category
  80. Redirections all subcategory to a new page
  81. next/previous stays within specific taxonomy term when in single post
  82. Exceute script on publishing or updating a new custom post record
  83. How to get a custom taxonomy slug in body classes
  84. How to use standalone Gutenberg (block editor) instance on any my own admin page in WordPress
  85. WordPress Page Width Issue: Seeking Solutions
  86. issues having 2 reader accounts. need to log in to two different accounts
  87. Is it posible to multiple entry value before submit Gravity forms?
  88. Images in an RSS feed
  89. WordPress Responsive Custom Control WP Customizer
  90. How to edit the new user email notification template
  91. Custom jQuery code in Elementor page is not working on Mac os. On Windows browser work fine
  92. Encrypt User last name in wordpress for security reasons
  93. Multiple wp.editor in a custom widget using JQuery
  94. Unable to edit the 1Homepage
  95. How to disable the PDF preview in the file block by default
  96. How do I get the URL section to show use a different domain in the WordPress Admin?
  97. Custom Logo: why parameters are not working at all?
  98. Customize style of window alert text
  99. Block Theme: How to use a different template on front page vs paginated pages?
  100. Customizing Additional CSS editor
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
  • 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