New answers tagged

9

time() only returns current time, it doesn't accept any inputs. $time = time(); // works out to 2016-04-11T12:11:34+00:00 What you want is midnight tomorrow: $tomorrow = strtotime( 'tomorrow' ); // works out to 2016-04-12T00:00:00+00:00 Note that these are PHP functions and they ignore WP timezone, since it resets PHP time zone to UTC. So if using ...


0

I have tried VA Simple Expires https://wordpress.org/plugins/va-simple-expires/ Works pretty well. Unfortunately Post Expirator plugin did not work for me because posts imported via CSV did not expire. Regarding VA Simple Expires - if you use CSV you should just add couple fields: scadenza-enable=1 scadenza-date=target time (e.g. 2016-04-10 00:42:00)


3

In your code you have: if ( isset( $_POST["run_import"] ) ) { add_action( 'import_execution_event_test', ... But when wp-cron.php is spawned, there's probably no POST variable called run_import, so your action is never added, and thus not triggered.


0

To answer your this query @sumit Are you sure about that? One of my friend said that if today it happens in 1.20 a.m next day it will happen after 1.20 a.m, not the 12 a.m. How it works: You schedule an event using current time stamp i.e. 12:00 AM on Monday wp_schedule_event(time(), 'daily', 'my_schedule_hook'); Someone visited the site on Monday ...


2

wp-cron is often called a pseudo-cron, because it doesn't run on a strict schedule. If nobody visits the site, it doesn't run. If you schedule a wp-cron event to run, say, every 12 hours, it will run at most every 12 hours. But, if your site has very little traffic, there could be far more than 12 hours between runs. If you need an event to happen every 12 ...



Top 50 recent answers are included