Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
25 Million+
Websites using our plugins
Years of WordPress experience
WordPress tutorials
by experts

What is: Cookies

Editorial Note: We earn a commission from partner links on WPBeginner. Commissions do not affect our editors' opinions or evaluations. Learn more about Editorial Process.

Cookies are small text files that temporarily save website-related data on a user’s computer. They are widely used on the web for storing information and providing a personalized browsing experience to users.

Most WordPress websites set cookies, such as when a user logs in or leaves a comment. Third-party plugins may also use cookies.

While cookies are extremely useful, they can also be invasive. That’s why some countries have laws that require website owners to disclose which cookies they use and what information they track and store.

What Is Cookies in WordPress?

What Are Cookies?

Cookies are plain text files that are created and stored in a user’s browser when they visit a website. The website stores temporary information in cookies that can be used to offer a more personalized user experience.

Cookies are used to add different features to a website, such as:

  • Remembering a user’s login credentials
  • Remembering information like the items a user saw on a website, the items they added to cart, and the name or email address they used on the website
  • Tracking users across a network of websites
  • Learning about a user’s browsing behaviors to serve targeted ads

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.

Deleting Cookies in Chrome

How Does WordPress Use Cookies?

By default, your WordPress website generates two types of cookies:

  • Session cookies are set when a user logs in to a WordPress site. They store the user’s authentication details and admin area settings and expire after 15 days when the user will have to log in again.
  • Comments cookies are set when a user leaves a comment on your WordPress blog. They store the user’s name, email address, and website URL so that they don’t have to re-enter it the next time they leave a comment. They expire after about 347 days.

Apart from these, WordPress plugins can also set their own cookies to store different information or recognize repeat visitors.

You can discover which cookies your site leaves by following our guide on how to know if your WordPress website uses cookies.

How Do 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 the user’s past behavior. Another plugin uses cookies so users can add favorite posts for the WordPress site.

Some WordPress plugins make it easy to turn off cookies. This lets you keep your website compliant with countries that have cookie laws. Here are some plugins that let you easily turn off cookies without breaking the plugin’s functionality:

We cover how to turn off cookies for these plugins in our guide on how to know if your WordPress website uses cookies.

If you’d like to learn how to make better use of cookies on your website, then see our guide on how to set, get, and delete WordPress cookies (like a Pro).

Cookies and Privacy

Cookies are a powerful tool that can be used to track a lot of information about users, and this information can be shared with third-party advertising platforms.

Considering the privacy risks, many countries and regions have laws that set compliance guidelines for website owners.

For instance, the European Union has the GDPR Law and ePrivacy Directive. Canada, the UK, Japan, and other countries also have laws that require website owners to get user consent and disclose the information they collect, store, and track about users.

That’s why you see cookie popups on many different websites. These banners allow website owners to comply with GDPR, cookie laws, and other privacy laws in different countries.

Cookie Notification

It is the responsibility of a website owner to comply with cookie laws in different regions. Here are some basic steps to make your website more compliant:

We hope this article helped you learn more about cookies in WordPress. You may also want to see our Additional Reading list below for related articles on useful WordPress tips, tricks, and ideas.

If you liked this guide, then please consider subscribing to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

Additional Reading

Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

The Ultimate WordPress Toolkit

Get FREE access to our toolkit - a collection of WordPress related products and resources that every professional should have!