Skip to content

Instantly share code, notes, and snippets.

@nicomollet
Created January 6, 2022 14:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicomollet/52cdb80bae187e4c87949519d4595838 to your computer and use it in GitHub Desktop.
Save nicomollet/52cdb80bae187e4c87949519d4595838 to your computer and use it in GitHub Desktop.
WordPress Core Updates: disable wp_version_check single event creation
<?php
/**
* Core Update: disable wp_version_check single event creation
*
* @param null|bool|WP_Error $pre Value to return instead. Default null to continue adding the event.
* @param stdClass $event {
* An object containing an event's data.
*
* @type string $hook Action hook to execute when the event is run.
* @type int $timestamp Unix timestamp (UTC) for when to next run the event.
* @type string|false $schedule How often the event should subsequently recur.
* @type array $args Array containing each separate argument to pass to the hook's callback function.
* @type int $interval The interval time in seconds for the schedule. Only present for recurring events.
* }
*
* @param bool $wp_error Whether to return a WP_Error on failure.
*/
function pre_schedule_event_disableversioncheck( $pre, $event, $wp_error ) {
if ( $event->hook === 'wp_version_check' && $event->schedule === false ) {
return new WP_Error(
'pre_schedule_event_false',
__( 'Disabling wp_version_check single event.' )
);
}
return $pre;
}
add_filter( 'pre_schedule_event', 'pre_schedule_event_disableversioncheck', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment