Automattic\WooCommerce\EmailEditor\Integrations\Core\Renderer\Blocks

Embed::may_attempt_embed_fetchprivateWC 1.0

Check whether an embed HTTP fetch may be performed and count the attempt. Enforces the MAX_EMBED_FETCHES cap shared by embed page fetches and oEmbed thumbnail lookups.

Method of the class: Embed{}

No Hooks.

Returns

true|false. True if the fetch is within the limit and may proceed.

Usage

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

Embed::may_attempt_embed_fetch() code WC 11.0.0

private function may_attempt_embed_fetch(): bool {
	if ( $this->embed_fetch_count >= self::MAX_EMBED_FETCHES ) {
		return false;
	}
	++$this->embed_fetch_count;
	return true;
}