Tulip Media

Entrepreneurial thoughts

How to customize the comment cookie expiration time in WordPress

In WordPress, the default how to cookie expiration time is up to 30,000,000 seconds. That's very long, especially for bloggers who are using cache plugins like W3 Total Cache. In fact, this plugin is not caching pages for visitors who have left comments on your blog, because of cookies, and until the cookie is cleared the plugin informs that cookie is rejected.
If you want to reduce the comment cookie expiration time, you have to play with the comment_cookie_lifetime filter in your functions.php file. You can set the expiration time you want, I thing 259 200 seconds in this example.
[icon style=”chain” color=”red”]functions.php[/icon]
[coded]
add_filter('comment_cookie_lifetime', 'my_comment_cookie_lifetime');
function my_comment_cookie_lifetime($lifetime) {
return 259200;
}
[/coded]
Via

 

My latest tweets

Nouveau short sur Blooness 👉 Relancer la libido, en vrac -> Soleil, vitamine D, diète céto-méditerranéenne, protéines, livres, badinage, marche, HIIT, et pas de régime hypocalorique.
https://buff.ly/445PWvc

Nouveau short sur Blooness 👉 Améliorer son sommeil -> s’exposer à la lumière le matin, limiter les lunettes de soleil, mouiller la chemise au sport, boire du déca, manger maximum 3h avant de dormir, faire une marche digestive et prendre de la mélaton
https://buff.ly/440weAJ

Load more

Don't miss business advice by email

No spam, just an email when new content is published.

One Response

  1. I am really impressed with your writing skills as well as with the layout on your weblog.
    Is this a paid theme or did you modify it yourself?
    Either way keep up the excellent quality writing, it is rare to
    see a nice blog like this one these days.

Leave a Reply

Your email address will not be published. Required fields are marked *

en_USEN