WordPress.org

Support

Support » How-To and Troubleshooting » PHP Session in a page-template?

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, '/', '.mydomain.com');
    				//session_start();
    				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())
    session_start();

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

    `

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