Automattic\WooCommerce\Internal\Features
FeaturesController::maybe_invalidate_cached_plugin_data
If the 'incompatible with features' plugin list is being rendered, invalidate existing cached plugin data.
This heads off a problem in which WordPress's get_plugins() may be called much earlier in the request (by third party code, for example), the results of which are cached, and before WooCommerce can modify the list to inject useful information of its own.
Method of the class: FeaturesController{}
No Hooks.
Returns
void. Nothing (null).
Usage
$FeaturesController = new FeaturesController(); $FeaturesController->maybe_invalidate_cached_plugin_data(): void;
Notes
| See: https://github.com/woocommerce/woocommerce/issues/37343 |
FeaturesController::maybe_invalidate_cached_plugin_data() FeaturesController::maybe invalidate cached plugin data code WC 11.0.1
public function maybe_invalidate_cached_plugin_data(): void {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended, WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
if ( ( $_GET['plugin_status'] ?? '' ) === 'incompatible_with_feature' ) {
wp_cache_delete( 'plugins', 'plugins' );
}
}