WC_HTTPS::force_https_page_link()public staticWC 1.0

Force a post link to be SSL if needed.

Method of the class: WC_HTTPS{}

No Hooks.

Return

String.

Usage

$result = WC_HTTPS::force_https_page_link( $link, $page_id );
$link(string) (required)
-
$page_id(int) (required)
-

WC_HTTPS::force_https_page_link() code WC 9.4.2

public static function force_https_page_link( $link, $page_id ) {
	if ( in_array( $page_id, array( get_option( 'woocommerce_checkout_page_id' ), get_option( 'woocommerce_myaccount_page_id' ) ) ) ) {
		$link = str_replace( 'http:', 'https:', $link );
	} elseif ( 'yes' === get_option( 'woocommerce_unforce_ssl_checkout' ) && ! wc_site_is_https() ) {
		$link = str_replace( 'https:', 'http:', $link );
	}
	return $link;
}