Skip to content

Instantly share code, notes, and snippets.

@tlovett1
Created April 12, 2016 16:02
Show Gist options
  • Save tlovett1/9a3b52946616143fec3824eabcdaa800 to your computer and use it in GitHub Desktop.
Save tlovett1/9a3b52946616143fec3824eabcdaa800 to your computer and use it in GitHub Desktop.
<?php
/*
Plugin Name: HTTP Redirect
Description: Redirect https to http on front end
Author: 10up
Version: 1.0
*/
add_action( 'parse_request', function() {
if ( is_admin() ) {
return;
}
if ( preg_match( '#wp-login\.php$#i', $_SERVER['REQUEST_URI'] ) ) {
return;
}
if ( ! empty( $_SERVER['HTTPS'] ) && $_SERVER['HTTPS'] === 'on' ) {
wp_redirect( 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] );
exit;
}
} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment