Skip to Content


Asynchronously load the Facebook SDK only when needed.

JavaScript February 7, 2021


This function runs automatically, so it is not called manually. Is this incorrect?

Additional Notes

This function looks for elements with a class that begins with fb- or a class of require-fbsdk anywhere to force it to load.

Was this page helpful? Yes No

    A feedback message is required to submit this form.

    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /assets/js/modules/social.js on line 4.

    No Hooks

    This function does not have any filters or actions available. Request one?
    nebula.facebookSDK = async function(){
        if ( jQuery('[class*="fb-"]:not(.fb-root), .require-fbsdk').length ){ //Only load the Facebook SDK when needed
            (function(d, s, id){
                var js, fjs = d.getElementsByTagName(s)[0];
                if ( d.getElementById(id) ){
                js = d.createElement(s);
       = id;
                js.src = '' + + '/all.js#xfbml=1&version=v3.0';
                fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));


    To override or disable this JavaScript function, simply redeclare it with the exact same function name.

    nebula.facebookSDK = function(){
        //Write your own code here, leave it blank, or return false.