Conditionally use SSL connections

This function can easily be modified to use conditional tags and force SSL on these pages. In this example SSL is limited to page id 12

/**
 * Snippet Name: Conditionally use SSL connections
 * Snippet URL: https://www.wpcustoms.net/snippets/conditionally-use-ssl-connections/
 */
  function wpc_use_ssl( $force_ssl, $post_id = 0, $url = '' ) {
    if ( $post_id == 12 ) {
        return true
    }
    return $force_ssl;
}
add_filter('force_ssl' , 'wpc_use_ssl', 10, 3); 

0 0 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x