¿Está buscando una manera de forzar páginas específicas para utilizar HTTPS y SSL? Este fragmento le permitirá forzar fácilmente páginas específicas en WordPress para ser seguro mediante el uso de HTTPS y SSL.
Instrucciones:
- Añada este código al archivo functions.php de su tema o en un plugin específico del sitio.
- En la línea 2, especifique el ID de la entrada o página que desee.
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);
Nota: Si es la primera vez que añade fragmentos de código en WordPress, consulte nuestra guía sobre cómo copiar / pegar correctamente fragmentos de código en WordPress, para no romper accidentalmente su sitio.
Si le gustó este fragmento de código, por favor considere revisar nuestros otros artículos en el sitio como: 6 Mejores Plugins de Seguridad para WordPress Comparados.
Dosent do anything. This is crap.
[…] → Source: http://wpsnipp.com/index.php/functions-php/force-specific-pages-to-be-secure-ssl-https/ […]
Doesn’t work, all you did was add a filter, you did not apply it anywhere or trigger it.
Hi Brad,
This should work without issue, although it could be something specific you are trying to do. Can you provide more details about what you are trying to do,
Your are right. It does not work. How it trigger for a page automatically .
Weel done!
But,what about login.php?
How can i use HTTPS at login page?
Thank you! 🙂
[…] Source […]
[…] Source: http://wpsnipp.com/index.php/functions-php/force-specific-pages… […]
Missing a ; after the return true 🙂
Thanks Kevin. What if we want to force 2 or more pages to be secure?
[…] to Kevin Chard for this […]
Can something similar be accomplished with specific sites on a WordPress multisite installation?
I’m sure it could, not something I have looked into though. Are these pages you are auto creating?
Thanks for this little but useful code lines.