Skip to content

Commit

Permalink
Update creame optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
pacotole committed Nov 13, 2023
1 parent b3cee72 commit e7f9bd9
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions web/app/mu-plugins/creame-optimize.php
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function creame_remove_hentry_class($classes) {
// Conditional plugin load.
function creame_active_plugins ($plugins){
// Heartbeat disable all
if (wp_doing_ajax() && 'heartbeat' === $_POST['action']) return [];
if (wp_doing_ajax() && isset($_POST['action']) && 'heartbeat' === $_POST['action']) return [];
// Admin only plugins
if (!defined('WP_CLI') && !is_admin()) return array_diff($plugins, [
'classic-editor/classic-editor.php',
Expand Down Expand Up @@ -441,7 +441,6 @@ function fix_admin_ithemes_icon_font() {
add_filter('itw_abspath', function($path){ return trailingslashit( WP_CONTENT_DIR ); });



/**
* ============================================================================
* WooCommerce
Expand Down Expand Up @@ -480,8 +479,8 @@ function creame_customer_hide_shipping($fields) {
if ('disabled' === get_option('woocommerce_ship_to_countries') || 'billing_only' === get_option('woocommerce_ship_to_destination')) unset($fields['shipping']);
return $fields;
}
add_filter('woocommerce_customer_meta_fields', 'creame_customer_hide_shipping');

add_filter('woocommerce_customer_meta_fields', 'creame_customer_hide_shipping');
// Fix prefetch & prerender links
function creame_fix_resource_hints($urls, $relation_type) {
if (!in_array($relation_type, ['prefetch', 'prerender'], true)) return $urls;
Expand All @@ -495,6 +494,11 @@ function creame_fix_resource_hints($urls, $relation_type) {
add_filter('wc_stripe_load_scripts_on_product_page_when_prbs_disabled', '__return_false');
add_filter('wc_stripe_load_scripts_on_cart_page_when_prbs_disabled', '__return_false');

// Disable ssl checkout on development
if (defined('WP_ENV') && WP_ENV === 'development') {
add_filter('pre_option_woocommerce_force_ssl_checkout', '__return_zero');
}


/**
* ============================================================================
Expand Down

0 comments on commit e7f9bd9

Please sign in to comment.