Visual Composer missing css files on same pages

For some strange reason, some CSS files are not loaded on certain pages, resulting in Font awesome characters not processing properly. Use below to force through JS as a fallback.

function missing_css_fix() {
function missing_css_fix () {
    var ss = document.styleSheets;
    for (var i = 0, max = ss.length; i < max; i++) {
        if (ss[i].href!=null && (new URL(ss[i].href).pathname) == "/wp-content/plugins/js_composer/assets/lib/bower/font-awesome/css/v4-shims.min.css?ver=6.2.0")
    var link = document.createElement("link");
    link.rel = "stylesheet";
    link.href = "/wp-content/plugins/js_composer/assets/lib/bower/font-awesome/css/v4-shims.min.css?ver=6.2.0";  //absolute url path (without domain)
add_action( 'wp_footer', 'missing_css_fix' );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>