Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailPostsCleanup::email_type_from_option_name │ private static │ WC 1.0

Derive the email type from a mapping option name.

Метод класса: WCEmailPostsCleanup{}

Хуков нет.

Возвращает

string|null. The email type, e.g. customer_new_account, or null when the name doesn't match the mapping shape exactly.

Использование

$result = WCEmailPostsCleanup::email_type_from_option_name( $option_name ): ?string;
$option_name(строка) (обязательный)
Option name, e.g. woocommerce_email_templates_customer_new_account_post_id.

Код WCEmailPostsCleanup::email_type_from_option_name() WC 11.2.2

private static function email_type_from_option_name( string $option_name ): ?string {
	if ( 1 !== preg_match( '/^woocommerce_email_templates_(.+)_post_id$/', $option_name, $matches ) ) {
		return null;
	}

	return $matches[1];
}