Created
July 25, 2013 15:45
-
-
Save WebEndevSnippets/6081062 to your computer and use it in GitHub Desktop.
WordPress: Redirect Page to HTTPS Secure (SSL)
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
add_action( 'template_redirect', 'webendev_secure_template_redirect', 1 ); | |
/** | |
* Redirect Page to https scheme | |
*/ | |
function webendev_secure_template_redirect() { | |
global $post; | |
if ( ( genesis_get_custom_field( 'wps_force_ssl' ) || is_page( 2048 ) ) && 'on' != $_SERVER['REDIRECT_HTTPS'] && 'on' != $_SERVER['HTTPS'] ) { | |
$post_data = get_post( $post->ID, ARRAY_A ); | |
wp_redirect( site_url( $post_data['post_name'], 'https' ) ); | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment