WordPress.org

Ready to get started?Download WordPress

Forums

Using Cookies in a Post (1 post)

  1. linx101
    Member
    Posted 7 years ago #

    I'm trying to append a variable to my URL's. So what I did is use PHP $_GET to read the variable and this code to read the cookie:
    $mycookie=$_COOKIE['mycookie'];

    I'm able to display the variable in my sidebar, but not in my posts unless I put the $_COOKIE code into each post.

    Since I have a lot of posts, I'm wondering if there's a way to read and use the cookie variable in all of my posts without manually inserting the code in each one. Just putting in the header.php or the single.php file doesn't work.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags