
I installed plugin Post Views Counter on my site to track post views and faced a problem right from the start. Every day my statistics for the previous day were deleted, and the graph showed only today’s views. Here is how I fixed the issue.
First of all, I checked plugin’s settings. There you can set a cleanup interval. It was 0 by default, but my data was still deleted. The description makes it clear that this is unexpected behavior.

The first solution is to set enormous value – up to 999,999 years.
But I don’t like that. If there is a bug with the 0 value, there might be another with 999,999 years in the future. My goal was to eliminate any opportunity of deleting my data.
So I looked into the code and figured out that the plugin uses the cron schedule post_views_counter_interval for cleaning data. I installed another plugin, WP Crontrol, in the hope that with its help I would be able to turn the schedule off. But no. That’s not going to work because it can’t control schedules from other plugins.

The actual solution was to add the code into function.php of my theme to disable the schedule.
add_filter( 'cron_schedules', function( $schedules ) {
unset( $schedules['post_views_counter_interval'] );
return $schedules;
});Now I’m 100% sure that plugin won’t delete my data.
Update
Some time ago I checked if the bug was fixed, and it really was, so I removed the filter. Anyway, I think this post is still useful for similar situations when a plugin creates cron schedules you don’t need.
