Created
March 14, 2012 11:37
-
-
Save strangerstudios/2035922 to your computer and use it in GitHub Desktop.
Using WordPress HTTPS with Paid Memberships Pro
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 | |
/* | |
Some WordPress HTTPS Fixes | |
In general, if you are using Paid Memberships Pro, you do not want to use the WordPress HTTPS plugin. PMPro will also secure your links. | |
If you are still receiving SSL errors on your checkout page, try setting the "nuclear" option on the Payment Gateway and SSL settings page of PMPro (v 1.3.19+) | |
If you want to continue using WordPress HTTPS for some reason, add this code to your theme's functions.php or somewhere else to force Paid Memberships Pro | |
to follow WordPress HTTPS' rules for redirecting, etc. | |
*/ | |
//if WordPress HTTPS is activated allow their force_ssl custom field to replace the besecure one | |
function pmpro_WordPressHTTPSForceSSL($besecure) | |
{ | |
include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); | |
if(is_plugin_active("wordpress-https")) | |
{ | |
global $post; | |
$force_ssl = get_post_meta($post->ID, "force_ssl", true); | |
if(!empty($force_ssl)) | |
{ | |
//WordPress HTTPS wants us to be secure | |
$besecure = $force_ssl; | |
} | |
else | |
{ | |
if(get_option('wordpress-https_exclusive_https') == 1) | |
{ | |
//WordPress HTTPS doesn't want this page to be secure | |
$besecure = false; | |
} | |
else | |
{ | |
//we should be good to do what we were going to | |
} | |
} | |
} | |
return $besecure; | |
} | |
add_filter("pmpro_besecure", "pmpro_WordPressHTTPSForceSSL", 2); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment