{"id":2835,"date":"2020-05-25T09:13:14","date_gmt":"2020-05-25T08:13:14","guid":{"rendered":"https:\/\/ibex.tech\/cloud\/?p=2835"},"modified":"2025-04-13T10:38:13","modified_gmt":"2025-04-13T09:38:13","slug":"keep-users-logged-in","status":"publish","type":"post","link":"https:\/\/ibex.tech\/cloud\/wordpress\/users\/keep-users-logged-in","title":{"rendered":"Keep Users Logged In"},"content":{"rendered":"\n<h4 class=\"wp-block-heading\">Setting A Custom Session Timeout<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/****************************************************************\n\/\/****************************************************************\n\/\/********** OVERRIDE WORDPRESS DEFAULT SESSION TIMEOUT **********\n\/\/****************************************************************\n\/\/****************************************************************\nadd_filter('auth_cookie_expiration', 'my_expiration_filter', 99, 3);\nfunction my_expiration_filter($seconds, $user_id, $remember)\n{\n  \/\/Set expiration to 48 hrs\n  \/\/$expiration = 2*24*60*60;\n  \n  \/\/Set expiration to 2 weeks\n  $expiration = 14*24*60*60;\n\n  \/\/http:\/\/en.wikipedia.org\/wiki\/Year_2038_problem\n  if ( PHP_INT_MAX - time() &lt; $expiration )\n      $expiration =  PHP_INT_MAX - time() - 5;    \/\/Fix to a little bit earlier\n\n  return $expiration;\n}<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Setting A Custom Session Timeout<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[228,173,168],"tags":[],"class_list":["post-2835","post","type-post","status-publish","format-standard","hentry","category-login-logout","category-sessions-wordpress","category-users"],"_links":{"self":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2835","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/comments?post=2835"}],"version-history":[{"count":1,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2835\/revisions"}],"predecessor-version":[{"id":2836,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/posts\/2835\/revisions\/2836"}],"wp:attachment":[{"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/media?parent=2835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/categories?post=2835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ibex.tech\/cloud\/wp-json\/wp\/v2\/tags?post=2835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}