WC_Emails::replace_placeholders()publicWC 3.7.0

Replace placeholder text in strings.

Method of the class: WC_Emails{}

No Hooks.

Return

String. Email footer text with any replacements done.

Usage

$WC_Emails = new WC_Emails();
$WC_Emails->replace_placeholders( $string );
$string(string) (required)
Email footer text.

Changelog

Since 3.7.0 Introduced.

WC_Emails::replace_placeholders() code WC 8.6.1

public function replace_placeholders( $string ) {
	$domain = wp_parse_url( home_url(), PHP_URL_HOST );

	return str_replace(
		array(
			'{site_title}',
			'{site_address}',
			'{site_url}',
			'{woocommerce}',
			'{WooCommerce}',
		),
		array(
			$this->get_blogname(),
			$domain,
			$domain,
			'<a href="https://woo.com">WooCommerce</a>',
			'<a href="https://woo.com">WooCommerce</a>',
		),
		$string
	);
}