Support » Fixing WordPress » PHP Session in a page-template?

  • I know there are a lot of posts out there in how to enable sessions in wordpress. somehow NOTHING works for me.

    i’m currently working on a custom page template where i want to save a session cookie.

    session_set_cookie_params(0, '/', '');
    				if(!isset($_SESSION['ftp-password']) ) {
    					$_SESSION['ftp-password'] = $_POST['password'];
    				var_dump(ini_get_all('session')); //i can't find the cookie, It's not getting saved

    I’ve already added the following code to wp-config.php

    // enable sessions
    if (!session_id())

    However i can’t quite figure out why my session doesn’t get saved.
    Any idea?


Viewing 1 replies (of 1 total)
  • digitalmagicianz


    use session_start at the top of the page

    for example

    Template Name: Page

Viewing 1 replies (of 1 total)
  • The topic ‘PHP Session in a page-template?’ is closed to new replies.