Title: Setting SESSION variables.
Last modified: August 30, 2016

---

# Setting SESSION variables.

 *  [dsjohnson](https://wordpress.org/support/users/dsjohnson/)
 * (@dsjohnson)
 * [10 years, 6 months ago](https://wordpress.org/support/topic/setting-session-variables-1/)
 * <?php
    /* * Plugin Name: PGC_PDP_setcookie * Plugin URI: [http://www.quovadimus.net](http://www.quovadimus.net)*
   Descripton: This plugin bridges between WordPress and PGC PDP * Author: Dave 
   Johnson * Version: 0.1 * Author URI: saywhat *License: GPLv2 or later
 * I’m trying to write a plugin that accesses an external data bass and set a session
   variable from data in that database. All works except setting the session variable.
   I created a stripped down version that should start the session and set a single
   variable @ in it. However even that does not work. The session is started, the
   PHPSESSID cookie is created, the cookie value matches. But the variable is not
   set. Stripped down version is as follows:
 * Thanks
    */
 * add_action(‘init’, ‘PGCstartSession’, 1);
 * Function PGCstartSession(){ if (!isset($_SESSION)) {
    $timeout = 3600; session_set_cookie_params(
   $timeout ,’/’, ‘.pgcsoaring.org’); session_start(); $_SESSION[“var1”] = ‘dummy’;}}

The topic ‘Setting SESSION variables.’ is closed to new replies.

## Tags

 * [init](https://wordpress.org/support/topic-tag/init/)
 * [session](https://wordpress.org/support/topic-tag/session/)

 * 0 replies
 * 1 participant
 * Last reply from: [dsjohnson](https://wordpress.org/support/users/dsjohnson/)
 * Last activity: [10 years, 6 months ago](https://wordpress.org/support/topic/setting-session-variables-1/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
