Skip to content
Advertisement

How to use session in wordpress in plugin development

I am new to write a plugin ..I am having a testplugin.php file and a ajax.php file ..

My code in testplugin.php is

JavaScript

And my ajax.php consists of following code

JavaScript

And if use session_start();

I get following error

JavaScript

I just want to send array of data from one file of my plugin to another file …

Advertisement

Answer

Add following on your plugin or themes functions.php file

JavaScript

Next, to add data in SESSION

JavaScript

To get the data on ajax hooked function –

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement