Support » Plugin: Simple Session Support » simpleSessionSet($key, array());

Viewing 3 replies - 1 through 3 (of 3 total)
  • I needed the same thing (looks like I’m the most active user of this plugin.. :))

    I modified the Get and Set functions like so:

    function simpleSessionGet($key, $default='') {
        if(isset($_SESSION[$key])) {
            return unserialize($_SESSION[$key]);
        } else {
            return $default;
    function simpleSessionSet($key, $value) {
        $_SESSION[$key] = serialize($value);

    The trick is to save all data serialized in the session, and unserialize it again when you need to retrieve it.

    If you don’t like to modify the plugin code (even though I believe the code is more robust with my modifications), you could just call the functions like this: simpleSessionSet($key, serialize($value)) and unserialize(simpleSessionGet($key))

    In you particular case
    would be equivalent to
    simpleSessionSet('hashed_urls', array($_url=>$value));
    if you used the modified plugin code.

    Plugin Author Peter Wooster


    Thanks Jules,

    Serialization is the way to go, I’ll probably add it as an option in the next release. I just completed testing everything for WP 3.8, but I will be making updates to my plugins.


    This is such an easy change to make, I’m not sure why you haven’t just pushed it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘simpleSessionSet($key, array());’ is closed to new replies.