WordPress at Your Fingertips
function is not described

wc_replace_policy_page_link_placeholders() WC 3.4.0

Replaces placeholders with links to WooCommerce policy pages.

No Hooks.

Return

String.

Usage

wc_replace_policy_page_link_placeholders( $text );
$text(string) (required)
Text to find/replace within.

Changelog

Since 3.4.0 Introduced.

Code of wc_replace_policy_page_link_placeholders() WC 5.6.0

function wc_replace_policy_page_link_placeholders( $text ) {
	$privacy_page_id = wc_privacy_policy_page_id();
	$terms_page_id   = wc_terms_and_conditions_page_id();
	$privacy_link    = $privacy_page_id ? '<a href="' . esc_url( get_permalink( $privacy_page_id ) ) . '" class="woocommerce-privacy-policy-link" target="_blank">' . __( 'privacy policy', 'woocommerce' ) . '</a>' : __( 'privacy policy', 'woocommerce' );
	$terms_link      = $terms_page_id ? '<a href="' . esc_url( get_permalink( $terms_page_id ) ) . '" class="woocommerce-terms-and-conditions-link" target="_blank">' . __( 'terms and conditions', 'woocommerce' ) . '</a>' : __( 'terms and conditions', 'woocommerce' );

	$find_replace = array(
		'[terms]'          => $terms_link,
		'[privacy_policy]' => $privacy_link,
	);

	return str_replace( array_keys( $find_replace ), array_values( $find_replace ), $text );
}