Skip to content

Instantly share code, notes, and snippets.

@mohsinrasool
Created March 20, 2018 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mohsinrasool/9e586ffdf9388ece201f9e93744a9056 to your computer and use it in GitHub Desktop.
Save mohsinrasool/9e586ffdf9388ece201f9e93744a9056 to your computer and use it in GitHub Desktop.
WordPress Fix for soft SSL provided by Cloudflare
<?php
/**
* Add following snippet in functions.php of your active theme. it should fix both admin and frontend.
*/
function ms_admin_head() {
echo '<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">';
}
add_action( 'admin_print_styles', 'ms_admin_head', 1 );
add_action( 'wp_head', 'ms_admin_head', 1 );
add_action( 'login_enqueue_scripts', 'ms_admin_head', 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment