I need a code for web (Wordpress) that forces the reload of only the homepage of the site at a certain time, this for all users, for example at 6:10 p.m.
I need a code for web (Wordpress) that forces the reload of only the homepage of the site at a certain time, this for all users, for example at 6:10 p.m.
Please try the Javascript below:
function refreshAt(hours, minutes, seconds) {
var now = new Date();
var then = new Date();
if(now.getHours() > hours ||
(now.getHours() == hours && now.getMinutes() > minutes) ||
now.getHours() == hours && now.getMinutes() == minutes && now.getSeconds() >= seconds) {
then.setDate(now.getDate() + 1);
}
then.setHours(hours);
then.setMinutes(minutes);
then.setSeconds(seconds);
var timeout = (then.getTime() - now.getTime());
setTimeout(function() { window.location.reload(true); }, timeout);