I'm trying to optimize my website, get rid off unwanted scripts and styles. I wanted to ask what is the best way to do so. What is the difference between wp_deregister_script and wp_dequeue_script ? If I want to kick out some scripts and styles only from specific pages, and minify it with w3 total catches, won't it load anyway in one, combined, minified file?
EDIT
I'm trying to dequeue some js and styles with
add_action( 'wp_enqueue_scripts', 'my_dequeue_styles', PHP_INT_MAX );
function my_dequeue_styles() {
if ( is_front_page() ) {
wp_dequeue_script( 'somescript');
wp_dequeue_style( 'somecss');
}
}
But it doesn't seem to be working. is_front_page() is only one of conditions tht I tried to use. I placed the code at the begging of functions.php.