seancojr
4/4/2012 - 11:42 AM

Fixes SSL incompatibility in a WordPress site

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');

?>