Force SSL for Admin
Forces SSL (HTTPS) for WordPress admin area
PHP
function force_ssl_admin() {
if (!is_ssl()) {
wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301);
exit();
}
}
add_action('admin_init', 'force_ssl_admin');
Snippet Feedback
Did this snippet work for you? Do you have any questions about this snippet? Leave some feedback below.
SHARED BY
1 Views