Which method worked for you guys to eliminate render-blocking JavaScript and CSS in wordpress

I have tried different plugins, methods and gone through some old posts here. But, none of the methods seem to work. Has anyone tried a method or a plugin which worked?

Many of the websites using different themes achieve this. There must be a way to do this without much fuss.

Have you tried loading your Javascript in the footer @rahul11? CSS may be a little more difficult if you are loading external style sheets like Google Fonts etc… I think the Wordpress core needs to load several J Query scripts but you can probably defer them or load them Asynchronously to resolve things for you…

With Wordpress you should be able to append the A Sync parameter to any scrips that are loading and the pagespeed error will go away, have a look at this URL…

https://ikreativ.com/async-with-wordpress-enqueue/

Thanks for the link. I was trying to understand the method. To be honest, I am not good in coding, just know basics of html and css, so I was trying to fix this with a plugin or some instructions.

About, this method, as far as I understand, I have to put that async function for every script that loads? Please correct me if I am wrong. I am not sure if I have to put this separately in every plugin or just adding in function file of the theme will do.

1 Like

No problem @rahul11, Matthew Horne actually has a better way, he shows you how to defer and add the Async parameter, Im not sure Jquery will work though Rahul, that is important for the core of Wordpress, I need to test this myself soon, once I have it working I will tell you exactly how I did it…

http://matthewhorne.me/defer-async-wordpress-scripts/

And yes, you would need to specify each script in the functions.php file, make sure you back the files up first if you dont use a child theme…

Thank you very much :slight_smile:

I will try to do this myself as soon as possible. Yes, I am using the child theme. I just hope that I am able to do this because other methods are very lengthy and they raise some other issues in the theme. If this works, then I will implement this to my other website as well. :slight_smile:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.