From c0e01e88dcd2e19d54d0956c46e373010519ff24 Mon Sep 17 00:00:00 2001 From: Claudio Sanches Date: Fri, 12 Dec 2014 11:15:38 -0200 Subject: [PATCH] Fixed the force http option on customizer screen, closes #6809 --- includes/class-wc-https.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/includes/class-wc-https.php b/includes/class-wc-https.php index 8eaf0dc8f12..dd319596159 100644 --- a/includes/class-wc-https.php +++ b/includes/class-wc-https.php @@ -43,7 +43,7 @@ class WC_HTTPS { add_filter( 'page_link', array( __CLASS__, 'force_https_page_link' ), 10, 2 ); add_action( 'template_redirect', array( __CLASS__, 'force_https_template_redirect' ) ); - if ( 'yes' == get_option('woocommerce_unforce_ssl_checkout') ) { + if ( 'yes' == get_option( 'woocommerce_unforce_ssl_checkout' ) ) { add_action( 'template_redirect', array( __CLASS__, 'unforce_https_template_redirect' ) ); } } @@ -75,7 +75,7 @@ class WC_HTTPS { 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 ( get_option('woocommerce_unforce_ssl_checkout') == 'yes' ) { + } elseif ( 'yes' == get_option( 'woocommerce_unforce_ssl_checkout' ) ) { $link = str_replace( 'https:', 'http:', $link ); } return $link; @@ -101,6 +101,10 @@ class WC_HTTPS { * Template redirect - if we end up on a page ensure it has the correct http/https url */ public static function unforce_https_template_redirect() { + if ( function_exists( 'is_customize_preview' ) && is_customize_preview() ) { + return; + } + if ( is_ssl() && $_SERVER['REQUEST_URI'] && ! is_checkout() && ! is_ajax() && ! is_account_page() && apply_filters( 'woocommerce_unforce_ssl_checkout', true ) ) { if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {