• Resolved svenni

    (@svenschaetzl)


    Hello,
    inside of an wordpress plugin (plugin A) I start the session and write a variable:

    session_start();
    $_SESSION[‘LANDINGURL’] = ‘something’;

    In another plugin I try on another page to read it back (form plugin using a snippet from function.php).
    But there the variable is empty?

    What can I do to debug this issue?

    In MySQL I see that an entry was created.

    Thank you very much for any hint,
    Bye
    Sven

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Hi @svenschaetzl,

    Sorry to hear you’re having trouble. It’s hard to say what the issue might be without being able to look at the code.

    Is this site hosted on Pantheon? If not, could you share a small sample of the code you’ve written?

    One thought is that you might need to call session_start(); earlier when you’re trying to read the session data back.

    Thread Starter svenni

    (@svenschaetzl)

    Hi Daniel,

    thank you very much for your reply!
    Yes, you are right!

    Indeed I think I figured it out in the meantime.

    I just added this to functions.php and now it looks like its working:

    function kana_init_session() {
    session_start();
    }

    add_action(‘init’, ‘kana_init_session’, 1);

    Plugin Author Daniel Bachhuber

    (@danielbachhuber)

    Great! Glad to hear you were able to figure it out ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘What could be going wrong here?’ is closed to new replies.