Enable session in wordpress using function.php

Normally session will not work in wordpress and we need to enable session. We can enable it by initializing. Function for initializing session is
function init_sessions() {
if (!session_id()) {
session_start();
}
}
add_action(‘init’, ‘init_sessions’);

Just copy the code and paste it in your function.php

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.