Skip Navigation

[Resolved] Is there a way to only load Toolset Plugin JS on specified pages?

This support ticket is created 5 years, 3 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by Ronald 5 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#1311865

Tell us what you are trying to do?

I am building a new website using Google AMP and the official AMP plugin. As soon as you add any of the toolset plugins to a website, it starts loading toolset JS on the front end of the website.

I was hoping to use Toolset Access and Toolset Forms because this is going to be a user-submitted content site, but even just activating those two Toolset plugins loads three JS files on the frontend of the website and invalidates every page as AMP.

Since the Access plugin shouldn't need any front-end JS, and the Forms will be on specific pages, is there any way to limit the loading of the JS files to just those pages? That way I can choose not to validate as AMP on the post creation/edit pages and still validate as AMP everywhere else?

#1311949

Hello,

There isn't such kind of built-in feature within Toolset plugins.

Since Toolset Forms plugin is using shortcode to output forms in front-end, Forms plugin will not know there is a form shortcode in that page/page, until form shortcode are loaded. And then, it's too late for those certain scripts.

You can, at your own risk, dequeue those JS file scripts with custom codes
https://codex.wordpress.org/Function_Reference/wp_dequeue_script

But we don't suggest to do it, because all of them are needed for run Toolset plugins.

#1312587

I found that Advanced Custom Fields has acf_form to allow the creation of front-end posting/editing of posts and won't load JS site-wide. Sorry your plugins couldn't have been more flexible... I would have continued using it.

EDIT: I would seriously consider adding AMP compatibility (either in core Toolset Plugins or as an addon. There are ways to adjust the behavior of plugins/themes if the official amp plugin is active).

When Auttomatic/Wordpress puts their support behind something, it usually ends up in core WordPress a few years later (take Gutenberg for example, the plugin was first, then it showed up in core). Now they are also throwing their weight behind the official WordPress Amp Plugin so I wouldn't be surprised if 4-5 years from now the AMP plugin is integrated into WordPress core. Just a thought...