remove render blocking resources

Hello so i have a general question about some scripts and css files that i have, which i want to remove from my website COMPLETELY in order to speed it up.

I am aware the method to do it is to dequeue the files, however what if i wanted to delete them entirely? They are old scripts bundled with the theme that i dont want (like pretty photo, etc.)

IS this correct and allowed? I created a staging copy to test this:

1) delete the enqueue from the functions.php
2) Delete the files from the server completely
3) Also remove from the functions.php of the child theme.

Is this a correct method of removing scripts completely? (i have made a backup of the files and the functions jic anyway

  • Rupok
    • Support Ninja

    Hi Huzaifah

    Hope you had a wonderful day.

    Is this a correct method of removing scripts completely?

    Actually what you did will be enough if your theme and plugin don't get updated. Because if you plugin and theme (where you removed the enqueue function and dequeued those scripts) gets updated, these functions will be back and your custom code will be gone.

    So the best way will be dequeue them through MU Plugin. For creating a mu plugin, create a folder named "mu-plugins" inside your "wp-content" folder. Then inside that "mu-plugins" folder, create a file with any name and with a .php extension. Now paste the code (which will dequeue the redundant scripts) inside that file and save.

    For getting more idea on mu plugins, you can go through this article: https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    To know more about dequeuing scripts, you can also check this article: https://codex.wordpress.org/Function_Reference/wp_dequeue_script

    But if there is no chance for your active theme and those old plugins to be updated, then what you already did is enough.

    Please let us know if you have any confusion. We will be glad to help.

    Have a nice day. Cheers!
    Rupok

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.