Skip to content

Instantly share code, notes, and snippets.

View danichim's full-sized avatar

Dan Ichim danichim

View GitHub Profile
@danichim
danichim / woocommerce-optimize-scripts.php
Created February 15, 2021 10:11 — forked from apsolut/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );