您可以检查站点is SSL 什么时候enqueueing your JS files.
function theme_name_scripts() {
if( is_ssl() ){
# Running HTTPS
wp_enqueue_script( \'https-js\', get_template_directory_uri() . \'/js/https.js );
}
else{
# Not HTTPS
wp_enqueue_script( \'http-js\', get_template_directory_uri() . \'/js/http.js );
}
}
add_action( \'wp_enqueue_scripts\', \'theme_name_scripts\' );