Skip to content

Instantly share code, notes, and snippets.

@seancojr
Created April 4, 2012 11:42
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seancojr/2300512 to your computer and use it in GitHub Desktop.
Save seancojr/2300512 to your computer and use it in GitHub Desktop.
Fixes SSL incompatibility in a WordPress site
<?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