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

New shorts on Blooness 👉 Training dedicated to the best oilseeds for health is finally available in audio format https://buff.ly/3xo9fTS
https://buff.ly/43DkrYR

New shorts on Blooness 👉 If there was only one supplement to take, it would be magnesium (along with vitamin D). The complete guide to the best multivitamins on the market still available here with free access https://buff.ly/49bHqvp
https://buff.ly/49c3rKK

New shorts on Blooness 👉 The latest Blooness training on #proteins is available in audio format https://buff.ly/4aijbMW
https://buff.ly/3TP67cB

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