Setting Cookies With Wordpress

2 replies
I need to be able to set cookies on specific pages. And redirects based on those cookies on other pages.

Does anyone know of a plugin that can do this?

Or does anyone have any other solutions?

Is there a way to put PHP code in the head of a page without having to edit the page template?


Thanks
#cookies #setting #wordpress
  • Profile picture of the author davidsbain
    There are various ways to do this. The way I do this would be to set the link up on the first page to point to another page within your site. The code for the second page would be as follows

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="XHTML namespace">
    <head>
    <meta http-equiv="Refresh" content="1; URL=http://youraffiliatelink" />
    <title>place the name of the product here</title>
    </head>
    </html>
    {{ DiscussionBoard.errors[2022880].message }}
  • Profile picture of the author Mirnova
    The problem is I'm working in Wordpress. I don't have direct access to the head section (unless I make a template for each page I need to set a cookie, and that just isn't practical).
    {{ DiscussionBoard.errors[2024050].message }}

Trending Topics