Force SSL on custom post types
This snippet tells WordPress to use a SSL connection if a single page from custom post types is visited (in this example, movies and books). Adjust as required and check out the codex for Conditional_Tags. It is also possible to use for a specific page ID or author archives. Options are endless.
/** * Snippet Name: Force SSL on custom post types * Snippet URL: https://wpcustoms.net/snippets/force-ssl-custom-post-types/ */ function wpc_force_ssl_cpt( $force_ssl, $url = '' ) { if ( is_singular( array( 'movies', 'book' ) ) ) { return true } return $force_ssl; } add_filter('force_ssl' , 'wpc_force_ssl_cpt', 10, 3);