How To Set and Use a Session Variable?
-
I am trying to use a session var in order to pass the value of the var around my blog but i cant figure out how to get my session to work basically.
This is what i have so far:
In wp-config.php:
session_start(); $_SESSION["ses_id"] = $_GET["the_id"];
This is my plugin:
function replace_with_the_id($content) { //replaces in RSS feed if (is_feed()) { $content = str_replace("%my_id%", $_GET['the_id'], $content); } //replaces in content of blog with value of ses_id if ($_SESSION["ses_id"]) { $content = str_replace("%my_id%", $_SESSION['ses_id'], $content); } return $content; } add_filter('the_content','replace_with_the_id');
The RSS part works perfectly and does not need to use any kind of session stuff, but the post content need to use the session var and when i use this method the var is empty…
any ideas? thoughts? insults ?? ?
I am not looking for someone to just code the whole thing out for me — any input would be of great help, thank you.
Viewing 9 replies - 1 through 9 (of 9 total)
Viewing 9 replies - 1 through 9 (of 9 total)
- The topic ‘How To Set and Use a Session Variable?’ is closed to new replies.