What am I doing wrong creating post draft via wp-cron? (wp_schedule_event & wp_insert_post)

The problem is that you’re only hooking the cron action on admin_init, which doesn’t run when wp-cron.php is called. So the function will never run. So this function shouldn’t be inside wpcp_activate(): add_action( ‘wpcp_cron_hook’, ‘wpcp_cron_do’ ); Also, register_activation_hook() shouldn’t be inside the admin_init hook either. So your code should look like this: function wpcp_make_post( $post_title, … Read more

WordPress CRON job working when reloading the page

WordPress Cron Jobs are not “real” Cronjobs, instead they relie on somebody visiting the site, then looking if it’s time to do scheduled jobs. 1.: Someone visits the website 2.: WordPress calls the file wp-cron.php 3.: wp-cron.php looks into the database if there are scheduled jobs that are due at this time. 4.: wp-cron.php does … Read more

Unknown requests on my WP Site

Your access logs will show all requests (traffic) to your site, including those that resulted in 404s. I suspect that your 404 page is not calling your function, so the request is not tracked. You should be able to get your access log from your hosting place, via the cPanel (assuming you are not self-hosted). … Read more

Schedule several instances of the same action with cron

Uh, I’m really developing a habit of answering my own questions. Turns out, you CAN queue multiple instaces for the same hook in WP-cron. The data that WP cron uses to separate the instances is the ARGUMENTS. They cannot be the same, or WP refuses to create the new cron job.

Server cron job not working

Check cache is disabled on live, then try. This is 99% likely a cache issue. If it was the other way around it would likely point to a FQDN issue whereby the domain does not resolve and you would need to modify host files.

How to Set a Condition via Page Template Name in WP Cron Job?

Finally i can able to achieve it. // custom_schedules_create function custom_schedules_create( $schedules ) { $schedules[‘every_three_minutes’] = array( ‘interval’ => 180, ‘display’ => __( ‘Every 3 Minutes’, ‘textdomain’ ) ); return $schedules; } add_filter( ‘cron_schedules’, ‘custom_schedules_create’ ); // custom_3minutes_event if ( ! wp_next_scheduled( ‘custom_3minutes_event’ ) ) { $myLocalGMTTimeEvent = time() + 6*60*60; wp_schedule_event( $myLocalGMTTimeEvent, ‘every_three_minutes’, ‘custom_3minutes_event’ … Read more