fix: guard is_woocommerce() with function_exists() — fatal when WC not active

Call to undefined function is_woocommerce() in perf-asset-policy.php:69
caused a 500 on all page loads. WooCommerce is not active on this site.
Added function_exists() guard so the WC asset dequeue block is skipped
when WooCommerce is not installed.
This commit is contained in:
peptiderepo
2026-04-23 23:50:44 +07:00
parent d79fc94061
commit 0c5db51739

View File

@@ -66,7 +66,7 @@ function peptide_starter_perf_dequeue_plugin_assets() {
}
// WooCommerce assets: dequeue on non-shop pages.
if ( ! is_woocommerce() && ! is_cart() && ! is_checkout() && ! is_account_page() ) {
if ( function_exists( 'is_woocommerce' ) && ! is_woocommerce() && ! is_cart() && ! is_checkout() && ! is_account_page() ) {
// Get configured WC handles from filter; default list.
$wc_styles = apply_filters(
'peptide_starter_perf_woocommerce_styles',