Ignore cached plugin data when checking if plugins are WooCommerce-aware.

This commit is contained in:
barryhughes 2023-06-20 13:12:13 -07:00
parent 79b52d2a5f
commit 1c2dd45ffd
2 changed files with 7 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
When detecting which plugins are WooCommerce-aware, improve accuracy by ignoring cached plugin data.

View File

@ -65,6 +65,9 @@ class PluginUtil {
*/
public function get_woocommerce_aware_plugins( bool $active_only = false ): array {
if ( is_null( $this->woocommerce_aware_plugins ) ) {
// In case `get_plugins` was called much earlier in the request (before our headers could be injected), we
// invalidate the plugin cache list.
wp_cache_delete( 'plugins', 'plugins' );
$all_plugins = $this->proxy->call_function( 'get_plugins' );
$this->woocommerce_aware_plugins =