Session for both WordPress and NON-WP pages

Have a WordPress site, with a directory that has non-WordPress pages in it. (a couple of php files)

The non-WP pages will perform a function with another non-wordpress site, and set a few session variables.

It would be helpful if WP be able to read those variables too, but it seems to treat the files at /directory/ (the non-wp pages) as a different independent session.

I’ve tried starting the session from either the wordpress pages or the non-wordpress pages, trying both simultaneously, and just initiating the session_start() vs testing for existing session (if (!session_id()) { session_start(); }) on both sides.

I echo out the session ID, and depending on which side (wp or NON-wp) starts, it, the other just doesn’t see a session. In fact, starting it in both (which should overwrite the other???), just makes two different concurrent session ID. And each set of pages retains its ID, so not like each is constantly getting a new one reset.

The Session should be global for the domain and for the browser/user, right? It should treat and the same?? Am I missing something about sessions?

Or am I missing something about WordPress? Is there some weirdness in WP or a setting somewhere that restricts its sessions to only the pages WP knows about? I know sessions aren’t part of the WP core, so it would seem strange that this would be the case, but lacking info here.

I tried searching for solutions, but either I’m just using too broad search terms, or this isn’t a common issue with both wp & non-wp pages and sessions.

NOTES: 1. Don’t think any plug-ins are calling session. 2. Want to keep it server side (no cookies) 3. Did change the htaccess, but that was just rewrite for that directory (and changed it back) 4. Can’t really merge the non-WP pages into the WP pages, so presumed session variables would work for the duration of the session.

Read more here: Session for both WordPress and NON-WP pages

Leave a Reply

Your email address will not be published. Required fields are marked *