WordPress tip: Force specific pages to be SSL secure

Just add the following snippet to the functions.php file of your WordPress theme and specify the post or page ID desired.

function wps_force_ssl( $force_ssl, $post_id = 0, $url = '' ) {
    if ( $post_id == 25 ) {
        return true
    }
    return $force_ssl;
}
add_filter('force_ssl' , 'wps_force_ssl', 10, 3);

Thanks to Kevin Chard for this recipe!

Leave a Reply

Your email address will not be published. Required fields are marked *