I see error messages in my PHP log like “WordPress database error Duplicate entry ‘YYYY-MM-DD’ for key ‘unique_date’ for …”

This is caused by a race condition in the code, it’s safe to ignore (it shouldn’t be labeled as an error really, but that is part of WordPress that we can’t control).

It happens when a new day starts and two visitors hit the site at nearly the same time for the first visit of the day. Both try and create a new row in the table to track the days views, but only one of them success and the other throws this warning.

Mostafa
Mostafa
Love working with WordPress, Laravel, and e-commerce platforms—basically anything that lets me create, innovate, and automate. Always up for a challenge, whether it’s in code or on the road.
Let’s get started
Take your business to next level

Become part of our growing family of +600,000 users and get the tools you need to make smart choices for your website. Simple, powerful insights are just a click away.