Automattic\WooCommerce\Internal\Admin\Emails

EmailListingRestController::maybe_flush_rewrite_rules │ private │ WC 1.0

Flush rewrite rules once per WC version so woo_email permalinks work.

Replaces the flush that used to happen during bulk post generation.

Method of the class: EmailListingRestController{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->maybe_flush_rewrite_rules(): void;

EmailListingRestController::maybe_flush_rewrite_rules() code WC 11.3.0

private function maybe_flush_rewrite_rules(): void {
	$wc_version = (string) Constants::get_constant( 'WC_VERSION' );
	if ( get_option( self::REWRITE_FLUSH_OPTION ) === $wc_version ) {
		return;
	}

	flush_rewrite_rules();
	update_option( self::REWRITE_FLUSH_OPTION, $wc_version, false );
}