WordPress.org

Ready to get started?Download WordPress

Forums

Using sessions to pass info between pages (1 post)

  1. blogdropper
    Member
    Posted 2 years ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic