public function headerDeferJavascripts()
    {
        add_filter('script_loader_tag', function ($tag, $handle) {
            // Main WP jQuery is not concerned
            if (strpos($tag, '/wp-includes/js/jquery/jquery')) {
                return $tag;
            }

            // Defer on MSIE is not permitted
            if (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9.')) {
                return $tag;
            }

            return str_replace(' src', ' defer src', $tag);
        }, 10, 2);
    }
public function headerDeferJavascripts()
    {
        add_filter('script_loader_tag', function ($tag, $handle) {
            // Main WP jQuery is not concerned
            if (strpos($tag, '/wp-includes/js/jquery/jquery')) {
                return $tag;
            }

            // Defer on MSIE is not permitted
            if (isset($_SERVER['HTTP_USER_AGENT']) && false !== strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 9.')) {
                return $tag;
            }

            return str_replace(' src', ' defer src', $tag);
        }, 10, 2);
    }
public function headerDeferJavascripts ( ) { add_filter ( 'script_loader_tag' , function ( $ tag , $ handle ) { // Main WP jQuery is not concerned if ( strpos ( $ tag , '/wp-includes/js/jquery/jquery' ) ) { return $ tag ; } // Defer on MSIE is not permitted if ( isset ( $ _SERVER [ 'HTTP_USER_AGENT' ] ) && false !== strpos ( $ _SERVER [ 'HTTP_USER_AGENT' ] , 'MSIE 9.' ) ) { return $ tag ; } return str_replace ( ' src' , ' defer src' , $ tag ) ; } , 10 , 2 ) ; }
Defer Javascripts calls
Defer Javascripts calls