Home / functions.php / Force specific pages to be secure, ssl, https
  • How to Force specific pages to be secure, ssl, https

    force-specific-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.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    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 codex functions, hooks, in this snippet. )

    add_filter, wp,