Skip to main content

I was asked by a client to make a webpage refresh every 5 mins. To do this I created them a shortcode that does exactly that.


function refresh_5_minutes_shortcode() {
$output = '<script type="text/javascript">
setInterval(function(){
location.reload();
}, 5 * 60 * 1000);
</script>';
return $output;
}
add_shortcode( 'refresh_5_minutes', 'refresh_5_minutes_shortcode' );

Leave a Reply