0

Guys I've inherited an older WordPress plug-in that was custom made by a previous developer. I'm refactoring it as it won't work with the latest wp but the previous dev has used sessions to send form variables from one form to another and I don't know why. I'd like it to be stateless in an ideal world but have been checking out the WordPress docs on cookies but they don't reveal a lot. Any ideas what I can do? Can I send the data without sessions using the native WordPress filters, hooks and actions etc. Cheers

Comments
  • 0
    Not to worry guys, I've solved this a few days back, I've just used native php session functionality instead. Wordpress doesn't always play nice with this but the main thing is to get it in before any headers are sent etc and to force some output buffering to prevent any headers being already sent error messages

    /*add this to your php */

    add_action('init', 'session_starter');

    function session_starter() {

    if (!session_id())
    session_start();

    }

    add_action('init', 'do_output_buffer');

    function do_output_buffer() {
    ob_start();
    }

    Then you can use normal session functionality as per the php docs here...

    http://php.net/manual/en/...
Add Comment