Skip to content

Commit

Permalink
Merge pull request #308 from ethitter/add/filter-disable-https-detect
Browse files Browse the repository at this point in the history
Allow HTTPS detection and UI to be disabled
  • Loading branch information
westonruter authored Jul 13, 2020
2 parents a518032 + ba4540e commit 99d0c81
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
10 changes: 10 additions & 0 deletions wp-includes/class-wp-https-detection.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down
5 changes: 5 additions & 0 deletions wp-includes/class-wp-https-ui.php
Original file line number Diff line number Diff line change
Expand Up @@ -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' ) );
Expand Down

0 comments on commit 99d0c81

Please sign in to comment.