What is the cron doing?
What is the cron doing?
What is the cron doing?
You can write your own wp_mail function that will override the core one and in your own function you can enqueque emails, and then dequeue them and send them with wp-crom events. Managing the queue is not trivial but should be doable. But the easier path is to use an external service that has an … Read more
As @Milo said, WP Cron will only really get triggered when someone requests something from WP, that is visit any WordPress page (I haven’t looked up the exact details so I don’t know if, for example, an AJAX request would trigger the scheduled event). You said that you have broken up the main task into … Read more
Simple Cronjob Walker Create a CPT cronjob for your cronjobs. Add the relevant post meta data (action, last_executed,… and whatever you need) Create a walker function function my_cronjob_walker() { $args= array( ‘post_type’ => ‘cronjob’, ‘posts_per_page’ => 1, ‘meta_key’ => ‘last_executed’ ‘orderby’ => ‘meta_value’, ); $cronjob = new WP_Query($args); if ($cronjob->have_posts()) while ($cronjob->have_posts()) { $cronjob->the_post(); // … Read more
I think you might be jumping the gun with actively discarding the data here. What if next month trolls go away, you change your mind, and want all those featured images back? I would just suppress them on front end by editing template and making thumbnail output conditional or filtering API with something like this: … Read more
No, The action will trigger when someone visits your WordPress site, if the scheduled time has passed. So if there no visitors crob job will not be triggered. In your case, it is better if you can run server cron job. Performance issue depend on the function you need to run as a cron job.
Are you constructing the class properly? Is the file writable? Do you need the interval or can you add the scheduled item if it doesn’t exist. This example is working, and sets an event 10 seconds into the future. wp_schedule_event( time() + 10, null, ‘ga_order_syn’ ); class CronTest { function __construct() { add_action( ‘init’, array … Read more
You need something like this: #!/bin/bash #test-httpd.sh client=”yourname” mailboxes=”[email protected]” # write to that file monitorfile=”/var/www/html/monitor.php” #empty monitor.php > $monitorfile APACHE=`/bin/pidof httpd` echo $APACHE if [ “$APACHE” == “” ] then echo APACHE_FAILURE | mail -s “$client””: CRITICAL : APACHE FAILURE !!!!” $mailboxes #trying to restart it /etc/init.d/httpd stop /etc/init.d/httpd start echo -e “apache:FAIL\n” >> $monitorfile … Read more
Techcrunch has released a library to spawn an asynchronous task within WordPress. https://github.com/techcrunch/wp-async-task Essentially, you can take any process that is triggered by an action hook, and you can defer the processing on that hook to run asynchronously. You extend the class to define which action you are triggering and a couple of functions to … Read more
how to make a cronjob run, when user needs to be logged in