For those accustomed to writing online in WordPress, WordPress offers a handy “offline drafting” feature. Even when an author is offline or disconnected due to unforeseen network issues, articles drafted on a local computer can automatically sync with the server once reconnected, saving writers from losing their hard work unexpectedly.
However, have you ever encountered a situation where WordPress offline drafting fails? I have personally lost quite a few paragraphs because of this (tears).
One such scenario occurs when a user’s session “times out” before the system can automatically back up the article to the server—perhaps due to a network interruption or before the autosave interval triggers. At this point, for security reasons, WordPress prompts you to log in again (as shown in Figure 1).
Figure 1: Session expired prompt window.
Here is where the trouble begins: because the latest content was not yet automatically backed up, logging in again forces a page refresh, which can tragically wipe out unsaved drafts. In my own worst experience, two full paragraphs vanished into thin air.
To avoid this disaster, aside from completing drafts in a single sitting or frequently clicking the "**Save Draft**" button, another reliable approach is to modify WordPress timeout settings—specifically, extending the countdown before a session expires.
Tutorial: How to Modify the WordPress Session Timeout Setting
To adjust the session expiration duration, go to the WordPress admin dashboard under “Appearance” > “Theme File Editor”, and locate the "**functions.php**" (Theme Functions) file.
Next, copy and paste the following snippet into the functions file and save your changes:
add_filter( 'auth_cookie_expiration', 'keep_me_logged_in_for_times' );
function keep_me_logged_in_for_times( $expirein )
{
return 31556926;
}
The duration in this snippet is measured in seconds. The parameter value 31556926 following return represents one year. You can change this to any duration you prefer (for instance, authors prioritizing security can set a shorter timeframe).
Further Reading:
Support Independent Perspectives & In-Depth Insights
Every thoughtful analysis and candid critique comes from our dedication to truth and quality. We choose not to follow sensational algorithms or clickbait headlines.
Sustaining independent research requires reader support. Make a one-time or monthly contribution, securely processed by Google.
Payments secured by Google · Manage or cancel anytime in your Google Account


Comments