weird $_SESSION problem in wp page template
-
I faced that a page template code run automatically where I didn’t execute that page template.
I have a example here.I have 1 page template named my_template.php
<?php /* Template Name: my_template */ $_SESSION['test_value'] = "wp Eror"; ?>
I have created 2 pages let page1 & page2 with my_template
The code of my header.php is
<?php //header.php echo "<pre>"; print_r($_SESSION); echo "</pre>"; //some code.
Now I am browsing my wp site without those page1 & page2.
Since I didn’t browse the page1 & page2 so the page template my_template.php shouldn’t be loaded. So I shouldn’t get the session value$_SESSION['test_value'] = "wp Eror";
in my site.Now the weird things is after browsing some pages ( without page1 & page2 ) of that site the session value will be loaded from the page template my_template.php. why ?
since I didn’t view that page template why that page template was executed?any solution?
Thanks in advanced.
- The topic ‘weird $_SESSION problem in wp page template’ is closed to new replies.