php - Session in wordpress not quite working -
i want use session function of php on word press blog. added session_start() wp-config.php file , commented wp_unregister_globals(); out.
with session_id(); able id shown in source code, nothing works, can't display session_id()
<div class="anzahl_pakete"> spendenpakete im parkkorb:[php] echo session_id(); $anzahl = 0; $keys = array_keys($_session); for($i=0;$i<count($keys);$i++) { if($_session[$keys[$i]] != 0) {$anzahl++;} } echo $anzahl;[/php]
try this
// on plugin or themes functions.php function register_session(){ if( !session_id()) session_start(); } add_action('init','register_session'); // on code $_session['key'] = $abc; // on ajax file if( !session_id()) session_start(); $abc = $_session['key'];
Comments
Post a Comment