Support » Plugin: Gutenberg Blocks – Ultimate Addons for Gutenberg » remove_action for generate_script to suppress jQuery errors

  • Resolved Fienen

    (@thequicksilver)


    We’re currently only using a couple basic blocks from UAGB, and there’s no JavaScript requirements for them. However, UAGB still outputs a script tag for an empty jQuery binding: ( function( $ ) {})(jQuery).

    Our theme is being carefully crafted to eliminate any dependency on jQuery, and I would like to eliminate the generate_scripts action to prevent the JS error thrown as a result, but doing a remove_action( 'wp_footer', array( 'UAGB_Helper', 'generate_script' ), 1001 ); doesn’t appear to suppress the function (I think because we need the object instance instead of the class name). I’m not seeing in the plugin code where there’s an exported object I can reference though to plug it in there, as the instance creation appears to use a self-reference.

    Ideally, I’d love for the plugin itself to know whether or not it needs to spit this out, and act accordingly. But in the mean time, what is considered the correct procedure for removing the action?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Team Brainstorm Force

    (@brainstormteam)

    Hey @thequicksilver,

    Thank you for your feedback.

    I have added this in our to-do list. We will definitely work on this for our future updates.

    For now, you can add the following code in your child theme’s function.php file to remove the generate_script function:

    if( class_exists( 'UAGB_Helper' ) ) {
    	$uagb_helper = UAGB_Helper::get_instance();
    	remove_action( 'wp_footer', array( $uagb_helper, 'generate_script' ), 1000 );
    }

    We appreciate your patience.

    Regards,
    Balachandar Karuparthy

    Fienen

    (@thequicksilver)

    Thanks! This worked perfectly for me.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘remove_action for generate_script to suppress jQuery errors’ is closed to new replies.