How can I prove if wp cron is running my task if I have DISABLE_WP_CRON set to true

I always found that logging cron job execution to a file is very helpful. Otherwise you have no idea if it’s working right. Just have your code open a file, write a timestamp, and close. Something simple like: $logfile = $_SERVER[‘DOCUMENT_ROOT’].’/CRON.txt’; $handle = fopen($logfile , ‘a’) or die(‘Cannot open file: ‘.$logfile ); $data=”cron task called … Read more

wp_schedule_event action not running

I think your problem may be in the use of $post->ID. In your code $post is an undefined variable. As you are inside a loop, try get_the_ID() instead of $post->ID: $post_ID = get_the_ID(); $request_start_time = get_post_meta( $post_ID, ‘_simple_start_date’, true ); if (date(‘Ymd’) == date(‘Ymd’, $request_start_time)){ $current_user = $post->post_author; $request_date = get_post_meta( $post_ID, ‘_simple_start_date’,true ); $request_year … Read more

Running Cron every 2 hours [duplicate]

An asterisk in the minute (first) field tells it to run every minute, regardless of the other fields. You need to specify an exact minute to run within the hour. Be that on the hour (0), half past (30), etc.. 0 */2 * * * /path-to-script

wp_schedule_event didn’t work

Cron fires outside of the standard WordPress loop, so $post will not be filled with any post-related data when the function is called. It should be obvious, then, that providing an ID directly isn’t referencing the non-existent $post variable which is why it works in that scenario. The best way to set post_statuses to expired … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)