What is: Cookies

Cookies are small files containing data sent by a website to store in user’s browser. Cookies are widely used on the web for storing information and providing a personalized browsing experience to users. Some common uses of cookies are:

  • Remember a user’s login credentials
  • Remember information like the items a user saw on a website, items they added to cart, name or email address they used on the website, etc.
  • Some larger websites use cookies to track users on their network of websites
  • Advertisers may use cookies to learn about user’s browsing behaviors

Many websites also store third-party cookies on user’s browsers. These cookies are usually generated by third party advertising scripts on websites. Most reputable websites usually have a privacy policy and terms of service pages where they mention how they use cookies on their websites.

Any user can delete cookies from their web browser by going to the privacy section on their browser’s settings.

How WordPress Uses Cookies

By default, WordPress generates two types of cookies.

  • Session cookies
  • Comments cookies

Session cookies are set when a user logs in to a WordPress site. These cookies contain a user’s authentication details, and the settings for the admin area interface. Login cookies in WordPress expire every 15 days.

When a user leaves a comment on a WordPress powered website, WordPress automatically sets a cookie containing user’s name, email address, and URL. This cookie allows WordPress to automatically fill username, email, and URL fields on the user’s subsequent visits. The comment cookie expires in 347.222 days or 30000000 seconds.

How WordPress Plugins use Cookies

WordPress plugins may use the information stored in the default cookies to provide personalization features. Plugins may also store their own cookies.

For example, OptinMonster uses cookies to show personalized optin forms based on user’s past behavior.

Another plugin, uses cookies so users can add favorite posts in WordPress.

The new EU privacy laws require websites to display a cookies popup on their website. We have a step by step guide on how to add a cookies notice on your WordPress site.

This post was originally published in the wpbeginner glossary.

Additional Reading