Tagged: https
Hello, I’ve found this on the net
function wp_force_ssl_https( $force_ssl, $post_id = 0, $url = '' ) {
if ( $post_id == 123 ) {
return true
}
return $force_ssl;
}
add_filter('force_ssl' , 'wp_force_ssl_https', 10, 3);
to force using SSL on specific pages. The instruction are to put this in functions.php so I’m asking you
1 – If I can use this as per instructions putting it in the functions.php
2 – In case I’ve more pages (suppose post_id=15 and post_id=65 how can I modify that code? Sorry for the question but I’m not a coder :-(
Thank you very much!
Hi andreamarucci!
You can place it in the bottom of the functions.php file.
To add more pages you can modify it like so.
function wp_force_ssl_https( $force_ssl, $post_id = 0, $url = '' ) {
if ( $post_id == 123 || $post_id == 12 || $post_id == 13 ) {
return true
}
return $force_ssl;
}
add_filter('force_ssl' , 'wp_force_ssl_https', 10, 3);
Best regards,
Elliott