keycdn / cache-enabler

A lightweight caching plugin for WordPress that makes your website faster by generating static HTML files.
https://wordpress.org/plugins/cache-enabler/
123 stars 46 forks source link

Undefined index: HTTP_HOST when running wp-cli command that imports products #68

Closed sandrodz closed 4 years ago

sandrodz commented 4 years ago

PHP Notice: Undefined index: HTTP_HOST in /var/www/superstore.wearede.com/public/plugins/cache-enabler/inc/cache_enabler_disk.class.php on line 603

My custom wp-cli command creates WooCommerce product drafts. Why is it triggering delete settings at all?

coreykn commented 4 years ago

This occurred because when any post type was saved the save_hook was being fired. This caused Cache_Enabler::check_future_posts() to be called. If there was not a cache timeout to be recorded Cache_Enabler_Disk::delete_advcache_settings() was being called.

Improving this behavior ties into #112. I've completed this enhancement and will open a PR shortly. This change will be released in version 1.5.0.