jstuartj.com

Home of J. Stuart J. Creative
The Minneapolis skyline with Stone Arch bridge in foreground.

Site now secured using Let’s Encrypt.

Everything went smoothly except for one plug-in, “Code Snippet Library” which loads Ace.js from CloudFront CDN via HTTP, which resulted in warnings about an insecure script. I needed to override the script and load it over HTTPS:

— UPDATE: I’ve stopped using “Code Snippet Library” and have switched over to EnlighterJS Syntax highlighter.

//* Override scripts in code snippit library to load via https://

function JSJ_reload_ace() {

  if ( class_exists('Code_Snippet_Library') ){

    // Remove the original hardcode script.
    wp_dequeue_script( 'ace' );
    wp_deregister_script( 'ace' );

    // Register the new script using https://
    wp_register_script( 'ace' , esc_url( 'https://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js' ) );
    wp_enqueue_script( 'ace');
    }
  }

add_action( 'wp_enqueue_scripts', 'JSJ_reload_ace' );

add_action( 'admin_enqueue_scripts','JSJ_reload_ace' );
Copyright © 2024, J. Stuart Johnson