Created
April 4, 2012 11:42
-
-
Save seancojr/2300512 to your computer and use it in GitHub Desktop.
Fixes SSL incompatibility in a WordPress site
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Add Support for HTTPS | |
Plugin URI: http://www.sitepoint.com/crimes-against-wordpress/ | |
Description: Fixes SSL incompatibility in a WordPress site | |
Version: 1.0 | |
Author: Andrew Tetlaw | |
Author URI: http://awesomebutuseless.com/ | |
License: GPL2 | |
*/ | |
function fix_ssl_siteurl($url) { | |
if ( 0 === strpos($url, 'http') && is_ssl() ) | |
$url = str_replace( 'http://', 'https://', $url ); | |
return $url; | |
} | |
add_filter('option_siteurl', 'fix_ssl_siteurl'); | |
add_filter('option_home', 'fix_ssl_siteurl'); | |
add_filter('option_url', 'fix_ssl_siteurl'); | |
add_filter('option_wpurl', 'fix_ssl_siteurl'); | |
add_filter('option_stylesheet_url', 'fix_ssl_siteurl'); | |
add_filter('option_template_url', 'fix_ssl_siteurl'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment