- Download the code and upload to your site's wp-content/plugins folder, or copy and paste the above code (minus the plugin header) to a custom functions plugin
- Activate the plugin
- A wp_cron event will be scheduled to do an hourly reset of the reservation counts
Last active
December 27, 2017 19:19
Star
You must be signed in to star a gist
Add an additional reset to the wp_cron schedule. This is a WordPress plugin.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Additional cron event to reset reservation counts | |
Plugin URI: https://eventespresso.com/ | |
Description: This plugin adds an additional reset to the wp_cron schedule. Runs every hour. | |
Version: 1.0 | |
Author: Event Espresso | |
Author URI: https://eventespresso.com/ | |
License: GPL2 | |
License URI: https://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
register_activation_hook(__FILE__, 'ee_rsrvd_activation'); | |
function ee_rsrvd_activation() { | |
if (! wp_next_scheduled ( 'ee_rsrvd_hourly_event' )) { | |
wp_schedule_event(time(), 'hourly', 'ee_rsrvd_hourly_event'); | |
} | |
} | |
add_action('ee_rsrvd_hourly_event', 'reset_rsrvd_counts_hourly'); | |
function reset_rsrvd_counts_hourly() { | |
\EED_Ticket_Sales_Monitor::reset_reservation_counts(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment