Return to Snippet

Revision: 74500
at November 24, 2018 02:32 by cerxx


Initial Code
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');

Initial URL
https://wd-x.ru/perenosim-vyzov-skriptov-v-podval-na-wordpress/

Initial Description
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

Initial Title
Transfer the call scripts from header to the footer on WordPress

Initial Tags
wordpress

Initial Language
PHP