‘wp_site_health_scheduled_check’ Causes Failure Of Other Scripts

First, turn on WP_DEBUG to get a log of the issue. In your wp-config.php you can add something like: define(‘WP_DEBUG’, true); //record all the errors define(‘WP_DEBUG_LOG’,__DIR__.’/wp-content/.wp-debug.log’); //you may want to move this to a more secure location (outside of the web root) define(‘WP_DEBUG_DISPLAY’, false); //don’t show errors on the front end Second, depending on your … Read more

wp_schedule_event with dynamic names but same function

This is what the 4th parameter, $args is for. Use a single name for the event and pass the unique name as an argument. public function schedule($interval, $event): void { $args = array($event); if (! \wp_next_scheduled(‘my_scheduled_event’, $args)) { \wp_schedule_event(time(), $interval, ‘my_scheduled_event’, $args); } } Then you can have a single callback function that has access … 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