Inventory_Presser_Taxonomies::schedule_terms_cron_job( bool $network_wide )
Schedules a daily WordPress cron job to clean up empty terms in a few of our taxonomies and also correct counts.
On This Page
Parameters Parameters
- $network_wide
-
(bool) (Required) True if this plugin is being Network Activated or Network Deactivated by the multisite admin.
Return Return
(void)
Source Source
File: includes/class-taxonomies.php
public static function schedule_terms_cron_job( $network_wide ) {
if ( ! wp_next_scheduled( self::CRON_HOOK_DELETE_TERMS ) ) {
if ( ! is_multisite() || ! $network_wide ) {
wp_schedule_event( time(), 'weekly', self::CRON_HOOK_DELETE_TERMS );
return;
}
$sites = get_sites(
array(
'network' => 1,
'limit' => apply_filters( 'invp_query_limit', 1000, __METHOD__ ),
)
);
foreach ( $sites as $site ) {
switch_to_blog( $site->blog_id );
wp_schedule_event( time(), 'daily', self::CRON_HOOK_DELETE_TERMS );
restore_current_blog();
}
}
}
Expand full source codeCollapse full source codeView on Github