WordPress Super Cache Plugin Sessions

WordPress Super Cache plugin  is “A very fast caching engine for WordPress that produces static html files”. If you need to start any kind of session with your wp-super-cache plugin, the easiest and simplest way is to add your session data to plugins/wp-super-cache/wp-cache-phase1.php file.

In my situation, I need to add Yoast Gravity Referer session data to my website. So I have added below session values at the top of plugins/wp-super-cache/wp-cache-phase1.php file.

<?php
session_start();
$_SESSION['gf_yst_referer'][] = $_SERVER['HTTP_REFERER'];
$_SESSION['gf_yst_pages'][] = "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

By this way you can keep your unique session values for every visitor, because wp super cache serves static html files but keeps running wp-cache-phase1.php file for all requests.

Bir yanıt yazın

E-posta adresiniz yayınlanmayacak. Gerekli alanlar * ile işaretlenmişlerdir