Site logo

Archived topic

Removing remnant javascript

11 replies · Started by Jeff on January 15, 2021

Viewing posts 1–12 of 12

Hi folks, I've read some posts that only the sticky requires javascript, but I'm having some trouble getting rid of a few remnants:

- Sticky is turned off
- Do have Menu Plus enabled, no other premium items besides elements
- javascript being loaded:

~~~
/wp-content/plugins/gp-premium/menu-plus/functions/js/sticky.min.js?ver=1.12.3
/wp-content/themes/generatepress/assets/js/navigation-search.min.js?ver=3.0.2
/wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
/wp-includes/js/jquery/jquery.min.js?ver=3.5.1
/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2
~~~

Any way I can get rid of any/all of these?

Hello, the sticky is turned off, so how can I get rid of the sticky javascript?
How can I get rid of all these javascripts?

~~~
/wp-content/plugins/gp-premium/menu-plus/functions/js/sticky.min.js?ver=1.12.3
/wp-content/themes/generatepress/assets/js/navigation-search.min.js?ver=3.0.2
/wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2
~~~

And how can I stop loading jquery?

I have zero plugins loading jquery. Is all of this loading because of Menu Plus?

Hi there,

can you share a link to your site where we can see these scripts being requested ?

Site: https://www.ufafun88.com

I see these scripts loaded when seeing the waterfall of resource loading using gtmetrix.com

You have the Mobile Sticky Header and Navigation Search enabled....

Ah, I had Sticky Navigation: Off, but in the Header it was still turned on. I've turned that off. It looks like jquery is no longer loading when that is turned off. Fantastic!

I see where I can turn Search off.

The only questions I have are how to get these two turned off?


/wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2

Hi there,

/wp-content/themes/generatepress/assets/js/dropdown-click.min.js?ver=3.0.2
/wp-content/themes/generatepress/assets/js/main.min.js?ver=3.0.2

If you wish to remove them from being queued, you can try adding these.

add_action( 'wp_enqueue_scripts', 'tu_remove_menu_scripts', 50 );
function tu_remove_menu_scripts() {
    wp_dequeue_script('generate-dropdown-click');
    wp_dequeue_script('generate-main');
}

Reminder: Dropdown-click script is used when you have "click" or "click arrow" enabled on your customizer's menu settings. Removing it may cause issues.

Great! I changed to "hover" on the customizer's menu settings, and the generate-dropdown-click script went away.

I can manually remove generate-main as you suggest. But is there anything I need it for? Is it always queued by default in GeneratePress regardless?

I can manually remove generate-main as you suggest. But is there anything I need it for? Is it always queued by default in GeneratePress regardless?

It is used by the theme for toggling things as well. Some lines in the script are being used for the navigation menu's tablet view.

Here's the readable view.
https://github.com/tomusborne/generatepress/blob/master/assets/js/main.js

The mobile menu doesn't work at all with generate-main disabled. I've re-enabled it, as it is a small price to pay for mobile menu support, until I take the time to figure out a workaround.

Thanks!

No problem. :)

This archived topic is closed to new replies.