WordPress at Your Fingertips
function is not described

wc_prevent_dangerous_auto_updates() WC 3.2.0

Prevent auto-updating the WooCommerce plugin on major releases if there are untested extensions active.

No Hooks.

Return

true|false.

Usage

wc_prevent_dangerous_auto_updates( $should_update, $plugin );
$should_update(true|false) (required)
If should update.
$plugin(object) (required)
Plugin data.

Changelog

Since 3.2.0 Introduced.

Code of wc_prevent_dangerous_auto_updates() WC 5.8.0

function wc_prevent_dangerous_auto_updates( $should_update, $plugin ) {
	if ( ! isset( $plugin->plugin, $plugin->new_version ) ) {
		return $should_update;
	}

	if ( 'woocommerce/woocommerce.php' !== $plugin->plugin ) {
		return $should_update;
	}

	if ( ! class_exists( 'WC_Plugin_Updates' ) ) {
		include_once dirname( __FILE__ ) . '/admin/plugin-updates/class-wc-plugin-updates.php';
	}

	$new_version    = wc_clean( $plugin->new_version );
	$plugin_updates = new WC_Plugin_Updates();
	$version_type   = Constants::get_constant( 'WC_SSR_PLUGIN_UPDATE_RELEASE_VERSION_TYPE' );
	if ( ! is_string( $version_type ) ) {
		$version_type = 'none';
	}
	$untested_plugins = $plugin_updates->get_untested_plugins( $new_version, $version_type );
	if ( ! empty( $untested_plugins ) ) {
		return false;
	}

	return $should_update;
}