diff --git a/wp-includes/class-wp-https-detection.php b/wp-includes/class-wp-https-detection.php index abe44831d..dd617320d 100644 --- a/wp-includes/class-wp-https-detection.php +++ b/wp-includes/class-wp-https-detection.php @@ -57,6 +57,16 @@ class WP_HTTPS_Detection { * Initializes the object. */ public function init() { + /** + * Filter tag to disable HTTPS detection and UI, such as when redirection + * is handled outside of WordPress. + * + * @param bool $disabled Disable detection and UI. + */ + if ( apply_filters( 'wp_https_detection_ui_disabled', false ) ) { + return; + } + add_action( 'init', array( $this, 'schedule_cron' ) ); add_action( self::CRON_HOOK, array( $this, 'update_https_support_options' ) ); add_filter( 'cron_request', array( $this, 'conditionally_prevent_sslverify' ), PHP_INT_MAX ); diff --git a/wp-includes/class-wp-https-ui.php b/wp-includes/class-wp-https-ui.php index 1dada7a3c..f176a97a0 100644 --- a/wp-includes/class-wp-https-ui.php +++ b/wp-includes/class-wp-https-ui.php @@ -79,6 +79,11 @@ public function __construct( $wp_https_detection ) { * Initializes the object. */ public function init() { + /** This filter is documented in wp-includes/class-wp-https-detection.php */ + if ( apply_filters( 'wp_https_detection_ui_disabled', false ) ) { + return; + } + add_action( 'admin_init', array( $this, 'init_admin' ) ); add_action( 'init', array( $this, 'filter_site_url_and_home' ) ); add_action( 'init', array( $this, 'filter_header' ) );