I recommend that you implement Redis on your server to balance the loads. It may also be that there is a lot of JavaScript loading in your themes, and wp rocket doesn't solve it at all. For it
The JS files should be loaded in the footer, just before the closing of the </body> tag.
When a browser loads a web page, JavaScript and CSS resources generally prevent the web page from displaying until the browser downloads and processes them. Some assets need to be downloaded and processed before displaying anything. For the fastest possible experience, you should load the scripts at the end of the document, just before closing. I put the code.
<? php
función move_scripts_from_head_to_footer () {
remove_action ('wp_head', 'wp_print_scripts');
remove_action ('wp_head', 'wp_print_head_scripts', 9);
remove_action ('wp_head', 'wp_enqueue_scripts', 1);
add_action ('wp_footer', 'wp_print_scripts', 5);
add_action ('wp_footer', 'wp_enqueue_scripts', 5);
add_action ('wp_footer', 'wp_print_head_scripts', 5);
}
add_action ('wp_enqueue_scripts', 'move_scripts_from_head_to_footer');
Asynchronous attribute If we do not indicate anything, the script will be executed immediately, blocking the analysis of the rest of the document. In WordPress we can add the following code snippet in our functions.php file:
<? php
function add_async_attr_to_all_scripts ($ etiqueta) {
return str_replace ('src', 'async = "async" src', $ etiqueta);
}
add_filter ('script_loader_tag', 'add_async_attr_to_all_scripts', 10);
It is used to prevent scripts from blocking the presentation of the rest of the page. The operation is similar to asynchronous, except that snooze indicates that the script runs when the page has finished parsing.
<? php
function add_defer_attr_to_all_scripts ($ etiqueta) {
return str_replace ('src', 'defer = "defer" src', $ tag);
}
add_filter ('script_loader_tag', 'add_defer_attr_to_all_scripts', 10);
We must be very careful when loading JavaScripts asynchronously. It could be the case of loading for example jQuery and a jQuery dependent library and this second library is loaded before jQuery even though we have put it below in our document. I recommend that you create a shortcode and include it in a page to test that everything is fine. I can guarantee that the load will be much better for you.