New answers tagged

0

If your web host won't let you have access to cron jobs, you can try one of the free external cron job services (I used one of these but now forgot which one) https://www.google.com/search?q=web+cron+free ... if your script has a public URL. I added a hashed code to my script to make sure no one could just call the script directly w/o the key.


-1

You could also use a webcron. A site or service that calls your domain in an interval. Kind of of like a "fake" visitor.


1

Your code for scheduling event isn't correct, here is the correct one: function hits_set_zero_schedule() { if ( ! wp_next_scheduled( 'hits_set_to_zero') ) wp_schedule_event( time(), 'daily', 'hits_set_zero' ); } add_action( 'wp', 'hits_set_zero_schedule' ); function hits_set_zero_func() { delete_post_meta( $post_id, 'post_views_count', true ); } ...



Top 50 recent answers are included