HELP: Code To Check Status And Write Debug Entry

You can get the response code with wp_remote_retrieve_response_code() and log the response with error_log(). function my_better_uptime_heartbeat() { $worked = false; $response = wp_remote_get( ‘https://betteruptime.com/api/v1/heartbeat/<heartbeat_ID>’ ); if ( ! is_wp_error( $response ) ) { if ( 200 == wp_remote_retrieve_response_code( $response ) ) { // It worked, no need to log anything. $worked = true; } } … Read more

Change a Post’s Status based on the date from a custom field? (for Event posts)

There are several little issues with your code. This is what I use for the exact same thing though and it works: // expire events on date field. if (!wp_next_scheduled(‘expire_events’)){ wp_schedule_event(time(), ‘daily’, ‘expire_events’); // this can be hourly, twicedaily, or daily } add_action(‘expire_events’, ‘expire_events_function’); function expire_events_function() { $today = date(‘Ymd’); $args = array( ‘post_type’ => … Read more

WP CRON Fails At 13:00 Every Day

After further troubleshooting today, and with outstanding support from SiteGround, I have found the root cause. Turns out that every time termly_account_update wp-cron action ran (scheduled every 24 hours), it would crash the wp-cron processes, causing all other due now wp-cron actions to fail, including my my_heartbeat action. termly_account_update is a wp-cron job associated with … Read more

understanding wp_next_scheduled

You’re probably attempting to add this too early. Wait for init. add_action( ‘init’, function () { if ( ! wp_next_scheduled( ‘send_booking_expiration_hook’ ) ) { wp_schedule_event( strtotime( ’12pm’ ), ‘hourly’, ‘send_booking_expiration_hook’ ); } } );

Cronjob function not executed – negative seconds

I’ve managed to fix it! The problem was calling the wrong add_action. I had: // Schedule Cron Job Event function custom_cron_job() { if ( ! wp_next_scheduled( ‘XML_import’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘XML_import’ ); } } add_action( ‘wp’, ‘custom_cron_job’ ); But it must be: // Schedule Cron Job Event if (! wp_next_scheduled( ‘xml’ ) … Read more

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