Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow HTTPS detection and UI to be disabled #308

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -38,6 +38,12 @@ class WP_HTTPS_Detection {
*/
const INSECURE_CONTENT_OPTION_NAME = 'insecure_content';

/**
* Filter tag to disable HTTPS detection and UI, such as when redirection is
* handled outside of WordPress.
*/
const FILTER_DISABLE = 'wp_https_detection_ui_disabled';

ethitter marked this conversation as resolved.
Show resolved Hide resolved
/**
* The tag names for insecure content.
*
Expand All @@ -57,6 +63,10 @@ class WP_HTTPS_Detection {
* Initializes the object.
*/
public function init() {
if ( apply_filters( self::FILTER_DISABLE, false ) ) {
ethitter marked this conversation as resolved.
Show resolved Hide resolved
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
4 changes: 4 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,10 @@ public function __construct( $wp_https_detection ) {
* Initializes the object.
*/
public function init() {
if ( apply_filters( WP_HTTPS_Detection::FILTER_DISABLE, false ) ) {
return;
}

ethitter marked this conversation as resolved.
Show resolved Hide resolved
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