Highfivery / zero-spam-for-wordpress

The WordPress Zero Spam plugin makes blocking spam a cinch without all the bloated options. Just install, activate, and say goodbye to spam.
https://wordpress.org/plugins/zero-spam/
72 stars 32 forks source link

[FEATURE] #266

Closed jonasm82 closed 2 years ago

jonasm82 commented 3 years ago

Is your feature request related to a problem? Please describe. I am using the CF7 integration and the David Walsh method. I am now seeing the davidwalsh,js file being loaded globally on my site. In my case I am however only needing it to protect my /contact page and do not require it to be loaded anywhere else and also prefer that it isn't to keep unnecessary network requests down.

Describe the solution you'd like Is there a function that I could use to safely unload the script everywhere other than on my contact page?

Describe alternatives you've considered I use the Asset Cleanup plugin which lets me manage where plugin and theme assets are loaded. For some reason however the davidwalsh.js asset isn't showing up as something I can exclude with Asset Cleanup which is a first for me. I'm assuming it must be getting loaded differently to how assets otherwise get loaded?

bmarshall511 commented 2 years ago

@jonasm82 You're exactly right, shouldn't load unless needed. Good news and bad news, the good news is this will be fixed in the next release. The bad news is, specific to CF7, they already load their scripts on all pages even if not needed which makes the David Walsh script load as well. There is a fix however found in their docs: https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/

bmarshall511 commented 2 years ago

@jonasm82 The new version had been released. If you could do me a favor and rate the plugin on WordPress, I'd really appreciate it: https://wordpress.org/plugins/zero-spam/

jonasm82 commented 2 years ago

@bmarshall511 Thank you for the update Ben, I already had CF7 asset loading optimized so everything looks good now. And have just left a rating & review. Cheers.