fbpx
How to Force Specific WordPress Pages to Be Secure (SSL/HTTPS)

How to Force Specific WordPress Pages to Be Secure (SSL/HTTPS)

You can easily force specific pages to be secure in WordPress using the following simple little snippet. Just add the following snippet to the functions.php of your WordPress theme and specify the post/page ID desired.

Instructions
Add this code to your functions.php file.

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

WordPress Hosting

Comments

Leave a Reply

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

WordPress Snippet Info

Tested with Wordpress v. 4.7.1
Review Status: Needs Review

How to Force Specific WordPress Pages to Be Secure (SSL/HTTPS)
3.6 (72%) 5 vote[s]
Please report broken snippets.
Report Broken Snippet
WordPress Hosting - WP Engine

Recent Comments