I did the following to make it work (I have the Code Igniter application in a separate directory in the Wordpress directory) - what I obviously do not like about this is that I had to change the main file in Wordpress,
First, I added the Code Igniter cookie name to the $ no_unset array in wp-includes / load.php. In my case, it was ci_session:
$no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix','ci_session' );
Secondly, I realized that the Wordpress add_magic_quotes function distorts the global $ _COOKIE. This caused CodeIgniter to re-create a cookie every time the page loads or redirect, thereby breaking any continuity. So, I commented on this line in wp-includes.load.php (near line 545)
//$_COOKIE = add_magic_quotes( $_COOKIE );
Then, to keep this feature in tactics for all other Wordpress-related cookies, I created the array_walk function to iterate over the global variable $ _COOKIE and apply add_magic_quotes to all cookies except my one in the wp-includes / load.php function
function ci_ignore_magic_quotes($value,$key) { if($key != "ci_session") { stripslashes_deep($value); } }
After that, I no longer had several cookies stored in my ci_sessions table, and the sessions were successfully saved.
Hope this helps!