Inventory_Presser_Taxonomies::remove_terms_cron_job( bool $network_wide )

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


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'   => apply_filters( 'invp_query_limit', 1000, __METHOD__ ),
			)
		);
		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();
		}
	}