Skip to content

Instantly share code, notes, and snippets.

@jessLundie
jessLundie / expand_access_subscription_downloads.php
Last active December 17, 2020 17:46
Expand access to subscription downloads in WooCommerce Subscriptions based on subscription status
<?php
function expand_access_subscription_downloads( $is_download_permitted, $subscription ) {
if ( $subscription->has_status ( 'cancelled', 'expired' ) ) {
return true;
}
return $is_download_permitted;
}
@jessLundie
jessLundie / gist:0ff2249bb4ec93eba6b45dcf26f25913
Created June 20, 2019 22:22
Remove 'woocommerce_deliver_webhook_async` scheduled actions
/* Change the date forward to do them 10 days at a time until they were all gone */
DELETE FROM `wp_posts`
WHERE `post_type` = 'scheduled-action'
AND `post_title` = 'woocommerce_deliver_webhook_async'
AND `post_date_gmt` < '2019-05-09 00:00:00'```
/* Clean up the pm and comments: */
@jessLundie
jessLundie / functions.php
Created August 27, 2020 00:55
Action Scheduler - single action - clean up WP Comments orphaned log entries
<?php
function reth_run_cleanup() {
if ( ! as_next_scheduled_action( 'action_scheduler/cleanup_wp_comment_logs' ) ) {
as_schedule_single_action( gmdate( 'U' ) + ( 60 * MINUTE_IN_SECONDS ), 'action_scheduler/cleanup_wp_comment_logs' );
}
}
add_action( 'init', 'reth_run_cleanup' );