• phpwpuser

    (@phpwpuser)


    Hello,

    I have my own PHP file in WP Theme dir.
    In the beginning of the file I use this line:
    require_once(rtrim($_SERVER[‘DOCUMENT_ROOT’], ‘/’) . ‘/wp-load.php’);

    This allows me to load Sessions. All script is finished. I did a lot of work. But just now notices, that this Session ends quite fast. I didn’t delete Session or do something like that. Why does WP close my Sessions? What to do, that these Sessions will be alive always until I will delete them? THANK YOU.

    • This topic was modified 4 years ago by t-p. Reason: Moved to Fixig WordPress from Developing with WordPress Developing with Wo
Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    Core WP doesn’t use PHP sessions. They can actually cause issues with API requests. It’d have no reason to close sessions if it doesn’t start them. If your session is being closed, it’s due to your theme or one of your plugins.

    FWIW, requiring wp-load.php is not considered to be an acceptable way to initiate WP because it’s not 100% portable to other sites. If you do so for your own specific site you can initiate WP that way if you want. Know that it might not work on all WP sites.

Viewing 1 replies (of 1 total)

The topic ‘WP SESSION – Ends Very Fast’ is closed to new replies.