In this tutorial you will know How to force specific pages to be secure, ssl, https. This is very simple & easy snippet to use in your current WordPress website.
It very easy code, you can change this code as per your requirement. Open your functions.php file from your current active wordpress theme.
Below filter will force to redirect your web url from http to https.
1 |
add_filter('force_ssl' , 'wps_force_ssl', 10, 3); |
Add below snippet in your theme’s functions.php file.
1 2 3 4 5 6 7 |
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); |
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.
Article Tags: force specific pages from http to https, redirect from http to https, redirect specific wordpress pages from http to https url, secure pages, wordpress secure pages