{"id":36587,"date":"2024-09-23T07:02:09","date_gmt":"2024-09-23T07:02:09","guid":{"rendered":"https:\/\/www.wpstaq.com\/?post_type=knowledgebase&#038;p=36587"},"modified":"2024-09-23T07:02:09","modified_gmt":"2024-09-23T07:02:09","slug":"extend-the-wordpress-session-time-without-automatic-logging-out","status":"publish","type":"knowledgebase","link":"https:\/\/www.wpstaq.com\/nz\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/","title":{"rendered":"Extend the WordPress Session Time Without Automatic Logging Out"},"content":{"rendered":"<p>If you&#8217;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.<\/p>\n<h2>Steps to Extend WordPress Session Time<\/h2>\n<p>If you are facing frequent logouts or session expiration messages, follow the steps below to adjust the session length for your WordPress site.<\/p>\n<h3>1. Log into Staq Panel<\/h3>\n<p>Log into your site&#8217;s Staq Panel. Navigate to <strong>WP Config File<\/strong>\u00a0under the Staq Panel settings for your website.<\/p>\n<h3>2. Add the Following Code<\/h3>\n<p>Please note that you cannot edit the wp.config.php directly for security reasons.<\/p>\n<p>The line of code is:<\/p>\n<p><code>define('AUTH_COOKIE_EXPIRATION', $expiration_in_seconds);<\/code><\/p>\n<p>however, WPStaq makes it much easier for you. Inside Name, insert <code>AUTH_COOKIE_EXPIRATION<\/code> only. Then, add the Value as seconds, i.e. <code>86400<\/code><code><\/code><\/p>\n<p>It should look like this:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-36588\" src=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png\" alt=\"\" width=\"761\" height=\"596\" srcset=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png 761w, https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration-300x235.png 300w\" sizes=\"auto, (max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>To workout the time in seconds, this is the formula,<strong><code>24 hours * 60 minutes * 60 seconds<\/code><\/strong><code><\/code><\/p>\n<h3>3. Save and Apply the Changes<\/h3>\n<p>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.<\/p>\n<h2>Additional Information<\/h2>\n<p>If you are seeing the login message &#8220;<strong>Your session has expired. Please log in to continue where you left off<\/strong>.&#8221;, 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.<\/p>\n<p>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.<\/p>\n<h2>Conclusion<\/h2>\n<p>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.<br \/>\nFor further assistance or troubleshooting, feel free to reach out to our support team.<\/p>\n","protected":false},"featured_media":0,"parent":0,"template":"","class_list":["post-36587","knowledgebase","type-knowledgebase","status-publish","hentry","categories-troubleshooting-other"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress\" \/>\n<meta property=\"og:description\" content=\"If you&#8217;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&hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/\" \/>\n<meta property=\"og:site_name\" content=\"Managed Hosting Platform for WordPress\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/staqhosting\/\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/\",\"name\":\"Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/add-auth-cookie-expiration.png\",\"datePublished\":\"2024-09-23T07:02:09+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/#breadcrumb\"},\"inLanguage\":\"en-nz\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-nz\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/add-auth-cookie-expiration.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2024\\\/09\\\/add-auth-cookie-expiration.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/knowledgebase\\\/extend-the-wordpress-session-time-without-automatic-logging-out\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.wpstaq.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Extend the WordPress Session Time Without Automatic Logging Out\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#website\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"name\":\"Managed Hosting Platform for WordPress\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.wpstaq.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-nz\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#organization\",\"name\":\"Staq\",\"alternateName\":\"WPStaq\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-nz\",\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"contentUrl\":\"https:\\\/\\\/www.wpstaq.com\\\/wp-content\\\/uploads\\\/2023\\\/05\\\/cropped-LogoNoText.png\",\"width\":512,\"height\":512,\"caption\":\"Staq\"},\"image\":{\"@id\":\"https:\\\/\\\/www.wpstaq.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/staqhosting\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/wpstaq\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/","og_locale":"en_US","og_type":"article","og_title":"Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress","og_description":"If you&#8217;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&hellip;","og_url":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/","og_site_name":"Managed Hosting Platform for WordPress","article_publisher":"https:\/\/www.facebook.com\/staqhosting\/","og_image":[{"url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/","url":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/","name":"Extend the WordPress Session Time Without Automatic Logging Out - Managed Hosting Platform for WordPress","isPartOf":{"@id":"https:\/\/www.wpstaq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/#primaryimage"},"image":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/#primaryimage"},"thumbnailUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png","datePublished":"2024-09-23T07:02:09+00:00","breadcrumb":{"@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/#breadcrumb"},"inLanguage":"en-nz","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/"]}]},{"@type":"ImageObject","inLanguage":"en-nz","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/#primaryimage","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2024\/09\/add-auth-cookie-expiration.png"},{"@type":"BreadcrumbList","@id":"https:\/\/www.wpstaq.com\/knowledgebase\/extend-the-wordpress-session-time-without-automatic-logging-out\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.wpstaq.com\/"},{"@type":"ListItem","position":2,"name":"Extend the WordPress Session Time Without Automatic Logging Out"}]},{"@type":"WebSite","@id":"https:\/\/www.wpstaq.com\/#website","url":"https:\/\/www.wpstaq.com\/","name":"Managed Hosting Platform for WordPress","description":"","publisher":{"@id":"https:\/\/www.wpstaq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wpstaq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-nz"},{"@type":"Organization","@id":"https:\/\/www.wpstaq.com\/#organization","name":"Staq","alternateName":"WPStaq","url":"https:\/\/www.wpstaq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-nz","@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","contentUrl":"https:\/\/www.wpstaq.com\/wp-content\/uploads\/2023\/05\/cropped-LogoNoText.png","width":512,"height":512,"caption":"Staq"},"image":{"@id":"https:\/\/www.wpstaq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/staqhosting\/","https:\/\/www.linkedin.com\/company\/wpstaq"]}]}},"_links":{"self":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/knowledgebase\/36587","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/knowledgebase"}],"about":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/types\/knowledgebase"}],"wp:attachment":[{"href":"https:\/\/www.wpstaq.com\/nz\/wp-json\/wp\/v2\/media?parent=36587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}