/** * FIX-046 — remove globally unused Open Sans and Droid Sans CSS on production. * Rollback: deactivate this isolated snippet and purge/warm WP Rocket. */ $ononews_fix046_is_production_frontend = static function () { if ( is_admin() ) { return false; } $host = isset( $_SERVER['HTTP_HOST'] ) ? strtolower( (string) wp_unslash( $_SERVER['HTTP_HOST'] ) ) : ''; $host = (string) preg_replace( '/:\\d+$/', '', $host ); return in_array( $host, array( 'ononews.co.il', 'www.ononews.co.il' ), true ); }; add_action( 'wp_enqueue_scripts', static function () use ( $ononews_fix046_is_production_frontend ) { if ( ! $ononews_fix046_is_production_frontend() ) { return; } foreach ( array( 'Open+Sans', 'Droid+Sans' ) as $handle ) { wp_dequeue_style( $handle ); } }, PHP_INT_MAX ); add_filter( 'style_loader_tag', static function ( $html, $handle ) use ( $ononews_fix046_is_production_frontend ) { if ( $ononews_fix046_is_production_frontend() && in_array( $handle, array( 'Open+Sans', 'Droid+Sans' ), true ) ) { return ''; } return $html; }, PHP_INT_MAX, 2 );