WC_Install::install()public staticWC 1.0

Install WC.

Method of the class: WC_Install{}

Return

null. Nothing (null).

Usage

$result = WC_Install::install();

WC_Install::install() code WC 9.4.2

public static function install() {
	if ( ! is_blog_installed() ) {
		return;
	}

	// Check if we are not already running this routine.
	if ( self::is_installing() ) {
		return;
	}

	// If we made it till here nothing is running yet, lets set the transient now.
	set_transient( 'wc_installing', 'yes', MINUTE_IN_SECONDS * 10 );
	wc_maybe_define_constant( 'WC_INSTALLING', true );

	try {
		self::install_core();
	} finally {
		delete_transient( 'wc_installing' );
	}

	// Use add_option() here to avoid overwriting this value with each
	// plugin version update. We base plugin age off of this value.
	add_option( 'woocommerce_admin_install_timestamp', time() );

	// Force a flush of rewrite rules even if the corresponding hook isn't initialized yet.
	if ( ! has_action( 'woocommerce_flush_rewrite_rules' ) ) {
		flush_rewrite_rules();
	}

	/**
	 * Flush the rewrite rules after install or update.
	 *
	 * @since 2.7.0
	 */
	do_action( 'woocommerce_flush_rewrite_rules' );
	/**
	 * Run after WooCommerce has been installed or updated.
	 *
	 * @since 3.2.0
	 */
	do_action( 'woocommerce_installed' );
	/**
	 * Run after WooCommerce Admin has been installed or updated.
	 *
	 * @since 6.5.0
	 */
	do_action( 'woocommerce_admin_installed' );
}