Getting Started

Deployment Deployment - Diagnose Migrations Staging

Site Management

Backups Client Reporting Passwords Plugin Automation Plugin Management - Global Plugins & Themes - Diagnose Plugins & Themes - General Plugins & Themes - Git Plugins & Themes - Logs Must Install White Label WordPress Updates

Caching & Performance

Caching Caching - Blogs/Articles Caching - Diagnose Caching - Git Caching - WooCommerce Redis Optimize & Scale

Security

Security Security - Firewall

SMTP, CDN & DNS

SMTP SendGrid CDN CDN - AWS CDN - Cloudflare CDN - Diagnose Domains & DNS

Server & Tools

Analytics & Logs CRON Jobs Database Debug Tool Git Monitoring PHP Settings Redirects SEO Tools Server Errors sFTP SSL

Staq Billing

Staq Billing > Account Staq Billing > Client Staq Billing > Setup

Media

Media Media - Diagnose Media - Optimize

Accounts & Billing

Accounts & Billing

General

WordPress Hosting Website Diagnose Troubleshoot - Other

Extend the WordPress Session Time Without Automatic Logging Out


On this page

    If you’re experiencing issues where WordPress logs you out too frequently or gives 400 errors when saving pages, you may need to extend the session time to prevent automatic logouts. This article explains how to modify your WordPress session duration to keep users logged in for a longer period by adjusting the authentication cookie expiration time.

    Steps to Extend WordPress Session Time

    If you are facing frequent logouts or session expiration messages, follow the steps below to adjust the session length for your WordPress site.

    1. Log into Staq Panel

    Log into your site’s Staq Panel. Navigate to WP Config File under the Staq Panel settings for your website.

    2. Add the Following Code

    Please note that you cannot edit the wp.config.php directly for security reasons.

    The line of code is:

    define('AUTH_COOKIE_EXPIRATION', $expiration_in_seconds);

    however, WPStaq makes it much easier for you. Inside Name, insert AUTH_COOKIE_EXPIRATION only. Then, add the Value as seconds, i.e. 86400

    It should look like this:

    To workout the time in seconds, this is the formula,24 hours * 60 minutes * 60 seconds

    3. Save and Apply the Changes

    After adding this line, save the changes to your `wp-config.php` file. This will extend the login session time and prevent users from being logged out prematurely.

    Additional Information

    If you are seeing the login message “Your session has expired. Please log in to continue where you left off.”, this indicates that WordPress has a short session expiration time. By modifying the `AUTH_COOKIE_EXPIRATION`, you can prevent the session from expiring too quickly.

    Additionally, in the event of persistent 400 errors when saving pages, check your NGINX Access logs in the Debug section of the Staq Panel. These errors could be caused by a brief server-side issue or conflicting requests, but if they are infrequent, they may not be indicative of a larger problem.

    Conclusion

    By following the steps above, you can extend the session time in WordPress and prevent automatic logouts. This solution will help maintain your workflow without interruption, keeping users logged in for longer periods as needed.
    For further assistance or troubleshooting, feel free to reach out to our support team.

    Need some help?

    We all do sometimes. Please reach out to our support team by dropping us a support ticket. We will respond fast.