Events Manager
[resolved] How to disable scripts? (11 posts)

  1. Ricardo
    Posted 4 years ago #

    I'm running EM 5.0rc1 over WP 3.3.

    By default, Events Manager loads all these scripts:


    and an extra inline JS code. I'm not using any of these scripts, at least not in the frontend, so I'd like to disable them in order to make the pages load faster.

    I already tried wp_dequeue_script unsuccessfully. Is there any other way to prevent all these scripts from loading?




  2. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 4 years ago #

    wp_dequeue_script should work. Make sure you call it using the right action, e.g. init

  3. Ricardo
    Posted 4 years ago #

    My bad, it does work. I was only dequeuing the script, I had to also deregister it. Here's the code, in case anyone else needs it:

    function disable_scripts () {
    	if ( !is_front_page() ) {

    Hooking it to wp_enqueue_scripts instead of init allows to use conditional tags like the one in the example.


  4. smarru
    Posted 4 years ago #


    Is there anyway to disable the following dependencies without disabling events-manager.js. Below dependencies are loaded in all pages. I think the below files are needed only in events calendar page. On all other pages we don't need the below dependencies. Only events-manager.js will suffice.

    I saw below statement in events-manager.php but I dont want to modify this in core plugins files.
    wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js',__FILE__), array('jquery', 'jquery-ui-core','jquery-ui-widget','jquery-ui-position','jquery-ui-sortable','jquery-ui-datepicker','jquery-ui-autocomplete'));

    Can you please help me?

    Thank you,

  5. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 4 years ago #

    not adviseable but possible, you'd have to remove the script e.g.


    and then re-enqueue it with a code similar what you pasted, but you need to check what page you're loading so if it's needed you do load these scripts (e.g. search page, bookings, submit events pages)

  6. adaldesign
    Posted 3 years ago #

    I've tried to implement the final result of what these posts suggest but 'events-manager' wont' load:

    add_action('wp_enqueue_scripts', 'child_enqueue_js', 20);
    function child_enqueue_js() { 
    	$eventsScripts = array(
    	wp_dequeue_script( $eventsScripts );
    	wp_deregister_script( $eventsScripts );
    	wp_enqueue_script('events-manager', plugins_url('includes/js/events-manager.js', 'events-manager'), 'jquery');

    The above code successfully removed the dependencies from being loaded, but it didn't bring the events-manager.js back.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    Since EM depends on those scripts, it won't load if you deregister them.

    I've been using "Use Google Libraries" - http://wordpress.org/extend/plugins/use-google-libraries/ and it may be of interest to you as instead of loading seperate files it loads one jquery ui library with all the dependencies, and from the Google CDN.

  8. adaldesign
    Posted 3 years ago #

    Thanks for the reply Marcus.

    To help you understand, the KenBurns Plugin I'm using already enqueued the following: http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/jquery-ui.min.js

    So I'm trying to remove redundant scripts as this seems to be causing conflicts.

    I'm going to try de-registering the events manager script altogether and reregistering it.

  9. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    The problem with that is you're enqueuing a version WP isn't using yet. Whilst our JS should work with later versions of jQuery UI, I've seen situations where plugins load the jquery-ui script ALONG with the ones loaded by WP, causing even more problems.

    I've suggested this to someone today, try the plugin above and see if it resets all the jQuery inclusions so it includes one jQuery library, once, and from the Google CDN

  10. adaldesign
    Posted 3 years ago #

    Thanks Marcus, this plugin you suggested did the trick:

    Use Google Libraries

  11. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 3 years ago #

    didn't work for everyone, glad it did for you ;)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Events Manager
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic