SSL Certificates
are small data files that digitally bind a cryptographic key to an organization’s details. When installed on a web server, it activates the padlock and the https protocol (over port 443) and allows secure connections from a web server to a browser. Typically, SSL is used to secure credit card transactions, data transfer and logins, and more recently is becoming the norm when securing browsing of social media sites.
SSL Certificates bind together:
- A domain name, server name or hostname.
- An organizational identity (i.e. company name) and location.
I’ve recently purchased SSL certificate on Crunchify.com as I’m planning to sell Premium Plugins on this site. Once you purchase SSL certificate then next immediate question comes into mind, how to enable it on Checkout or some other Page??
Another must read
:
- WordPress Tip: How to Disable Specific Plugin’s StyleSheet
- How to Secure your WordPress Plugin? Prevent CSRF Vulnerability
Well, below is a simplest code which works like charm. Just put it into your theme’s functions.php file.
function crunchify_force_ssl( $force_ssl, $post_id = 0, $url = '' ) { // List of post or page IDs on which you need SSL cert $list_of_post_page = array(2343, 153, 54, 5); if ( in_array( $post_id, $list_of_post_page ) ) { return true; } return $force_ssl; } add_filter('force_ssl' , 'crunchify_force_ssl', 10, 3);
Bonus:
1. How to setup WordPress SSL for the admin panel?
define('FORCE_SSL_ADMIN', true);
That part is actually pretty easy. Just drop this in the wp-config.php. That’ll force the entire admin over SSL, which is what you want in most cases.
2. How to just force the login page over SSL?
define('FORCE_SSL_LOGIN', true);
This will force the login and registration pages to be SSL. It is advisable to go for the first option though, and run your entire admin over SSL.
We have upgraded our steps. Kindly take a look at details on How to switch WordPress site completely over to HTTPs.