WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Please help! PHP session still not working

[Resolved] Please help! PHP session still not working

  • hello,

    i’ve tried adding session to my wordpress install.
    but still not working.

    added the following in functions.php

    function ses_init() {
    if (!session_id())
      session_start();
    }
    add_action('init','ses_init');

    also added “_SESSION” in “wp-includes/load.php”
    $no_unset = array( '_SESSION', 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );

    but these codes work in my localhost wp not in remote
    what do i need to do for sessions to work in remote server?
    i have no idea what to do next.

    any help is very much appreciated.
    thanks in advance

Viewing 1 replies (of 1 total)
  • this is fixed.
    if you had the same problem with me as mentioned above.
    try this:
    *make sure you only have 1

    if (!session_id())
      session_start();
    }

    in your wp files/themes/plugins
    i just found out that my ajax.php file also contains that code
    i also have one in functions.php. removing it from ajax.php
    did the trick.

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Please help! PHP session still not working’ is closed to new replies.