Inventory_Presser_Taxonomies::remove_terms_cron_job( bool $network_wide )

remove_terms_cron_job


Description Description

Removes a WordPress cron job that we schedule daily to clean up empty terms in a few of our taxonomies and also correct counts.


Top ↑

Parameters Parameters

$network_wide

(bool) (Required) True if this plugin is being Network Activated or Network Deactivated by the multisite admin


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/class-taxonomies.php

	public static function remove_terms_cron_job( $network_wide )
	{
		if( ! is_multisite() || ! $network_wide )
		{
			wp_unschedule_event( wp_next_scheduled( self::CRON_HOOK_DELETE_TERMS ), self::CRON_HOOK_DELETE_TERMS );
			return;
		}

		$sites = get_sites( array( 'network' => 1, 'limit' => 1000 ) );
		foreach( $sites as $site )
		{
			switch_to_blog( $site->blog_id );
			wp_unschedule_event( wp_next_scheduled( self::CRON_HOOK_DELETE_TERMS ), self::CRON_HOOK_DELETE_TERMS );
			restore_current_blog();
		}
	}