/ Published in: PHP
                    
                                        
If you have been able to check your site by means of the PageSpeed ??Insights service, you may notice that it is not an easy task to recruit even 80% of the test results. Only by completing most of the recommendations of Google, you can hope for an increase in performance.
And if the compression of CSS styles and JS scripts is quite capable of any webmaster, then here’s the point “Remove the JavaScript and CSS code that blocks the display of the top of the page” - there are problems. First of all, due to the fact that in WordPress, many scripts are called from “wp_head”, starting from the jquery library and ending with the components of installed plugins.
RU ? EN
                And if the compression of CSS styles and JS scripts is quite capable of any webmaster, then here’s the point “Remove the JavaScript and CSS code that blocks the display of the top of the page” - there are problems. First of all, due to the fact that in WordPress, many scripts are called from “wp_head”, starting from the jquery library and ending with the components of installed plugins.
RU ? EN
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
function footer_enqueue_scripts() {
# Udaliaem JavaScript iz zagolovka
remove_action('wp_head', 'wp_print_scripts');
remove_action('wp_head', 'wp_print_head_scripts', 9);
remove_action('wp_head', 'wp_enqueue_scripts', 1);
# Vyvodim v footer
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('after_setup_theme', 'footer_enqueue_scripts');
URL: https://wd-x.ru/perenosim-vyzov-skriptov-v-podval-na-wordpress/
Comments
 Subscribe to comments
                    Subscribe to comments
                
                