WordPress.org

Support

Support » How-To and Troubleshooting » Using sessions to pass info between pages

Using sessions to pass info between pages

  • Hi I’m trying to use a session variable to pass a page ID from one page to another – so I know where I’ve come from.
    I’m using the shortcode exec php plugin to insert the php

    At the start of wp_config.php I’ve put session_start();

    In the page I want to pass the page ID from I have:
    $_SESSION['pageID'] = get_the_ID();

    In the page I want to pass the page ID to I have:

    echo "page id =" . $_SESSION['pageID'] . PHP_EOL;

    but nothing is passed.

    Please can you explain what I’m doing wrong or how best to pass the page ID between pages.

    Thanks for any help

    David

  • The topic ‘Using sessions to pass info between pages’ is closed to new replies.
Skip to toolbar