Unloading JS
-
Hi Team,
I hope you are having a great week so far.
Currently, I am optimizing my website, and I want to minimize around 100+ requests from the Homepage.
Right now I am exploring the plugin and I want to ask some questions.
I tried unloading a specific JS from an external plugin via the plugin settings (see screenshot below), however I am getting a message saying the “The link has expired”
After clicking “Update” button, I am getting a message (see screenshot below)
Am I missing a configuration step? Or what is causing this message?
Cheers!
-
@goldenshawarma the reason you keep getting that error is that there are too many submitted fields and some of them are stripped from the POST request. I’m sure the max_input_vars value from php.ini is a low one. I would consider updating it to at least 3000.
Please check the following post which is written by the WooCommerce team: https://docs.woocommerce.com/document/problems-with-large-amounts-of-data-not-saving-variations-rates-etc/
Although they reference their own plugin, the same thing applies to Asset CleanUp Pro and any other plugin that adds fields to a form. You might have in the edit post/page area (e.g. the one having the URI: /wp-admin/post.php?post=[POST_ID_HERE]&action=edit) fields added by various plugins and when you submit the form, you will end up with some of the fields getting stripped.
I hope you’ll make the right change! Let me know how it goes! It should solve the problem you’re having! That error (The link has expired) is shown because the security nonce field – read more here: https://codex.ww.wp.xz.cn/WordPress_Nonces- is stripped and not sent for the plugin to verify it, thus having an empty value, the changes are not applied.
Thank you for the advice! I will change the PHP system variable as per instruction & I will let you know the result.
Cheers!
Hi @gabelivan
I changed the parameter value in the .htaccess file (see screenshot below)
I changed the parameter value in the php.ini file (see screenshot below)
If it still makes sense, I changed it in the wp-config file (see screenshot below)
So I tried unloading a JS from the plugin, but I am still getting “The Link you followed has expired” message.
I am not sure what am I missing here.
-
This reply was modified 4 years, 10 months ago by
Thomas.
@goldenshawarma can you check if the changes you made actually applied? Create a file such as info-437a4g42m34.php (e.g. a name hard to guess so only you could access it, you can delete the file later on) and put it in the WordPress root directory. The contents would be
<?php phpinfo(); ?>. Then, load it in your browser and search on the page (e.g. command + F via MacOS): “max_input_vars“. If no change was made, you need to contact your hosting company about this as they might have restrictions on it.Did you reboot the server after php.ini was updated? That’s what you need to do. Then, reload the CSS/JS manager and re-submit the form.
Roughly, how many CSS/JS assets do you have there? I mean, 3000 is a fairly high value to use for “max_input_vars“. You would need to have an unusually large number of CSS/JS loaded so that you would need to put a higher value there. Also, please use the manager from “CSS & JS Manager” -> “Manage CSS/JS” because it has fewer fields. If you use the one from the edit post/page area (e.g. /wp-admin/post.php?post=[POST_ID_HERE]&action=edit), it has more fields, including the fields appended by other plugins.
Hi @gabelivan
Apologies, it took me a while to perform the instructions you had sent to me.
Ok, so I was able to create a file and put it into the root directory.
I was able to render the system info function (see screenshot below)
The value for max_input_vars is 1000, although I should be expecting a value of 3000.
I already rebooted my Litespeed Server, which I host in my own VM machine in Google Cloud Platform hoping that the parameter change will take into effect.
And then I tried unloading a JS from a plugin I used for my checkout page in Woo (I am wondering why the JS is loaded/rendered on every page – a shocker).
JS script I am trying to unload
I am still getting the same error notification. I’ll try to revisit the parameter settings of max_input_vars.
@goldenshawarma in this case, it’s best to reach out to the hosting company. I know it can be frustrating, but they can explain to you if there’s any limitation on your account and they would be able to do the change for you.
Also, did you try to do the update from the “CSS & JS Manager” – “Manage CSS/JS area”? If it still doesn’t work, iut means you have an aweful lot of handles there that when you add them up, including the hidden fields, it goes over 1000 inputs.
Hi @gabelivan
Thanks for the information. When you say “handles”, do you mean JS requests (because on my homepage, I have like 200 requests, ugh) or in the context of the plugin?
Hi @gabelivan
I was able to change the max_input_vars via CyberPanel (there is a section for changing PHP config) and I changed the value there and restarted the PHP service
Now the value of the parameter max_input_vars is 3000 and went straight to the plugin settings to unload a JS.
Now I am able to unload the JS successfully.
Asset Cleanup JS Manager Screenshot 2
Thank you very much for your guidance! Cheers and have a great weekend hermano!
@goldenshawarma that’s fantastic news! I’m glad you finally managed to perform the unloading. I’m sure the updating of “max_input_vars” will help you out in other situations, outside Asset CleanUp.
PS: If you’re happy with the plugin overall, it would be great if you can spare a minute and leave a quick review about it here: https://ww.wp.xz.cn/support/plugin/wp-asset-clean-up/reviews/#new-post
-
This reply was modified 4 years, 10 months ago by
The topic ‘Unloading JS’ is closed to new replies.