Fatal error after deleting Woo attribute term

In woocommerce, when an attribute term is deleted, SG cache still has the product attribute terms cached and causes a fatal error on a product that has the deleted term until the SG cache is fully flushed. There should be a hook added to this plugin that clears the SG cache when an attribute is deleted.

To reproduce:

  • Create an attribute taxonomy then term under /wp-admin/edit.php?post_type=product&page=product_attributes
  • Add this attribute term to a product
  • Delete the term
  • Refresh the product page

Leads to fatal error until both memcache and supercacher cache is cleared

<b>Fatal error</b>: Uncaught TypeError: ltrim(): Argument #1 ($string) must be of type string, WP_Error given in /home/customer/www/www.example.com/wp-includes/formatting.php:4379

Fix is:

add_action(‘deleted_term_taxonomy’,function ($id)
    if (function_exists(‘sg_cachepress_purge_everything’) === true) {

  • This topic was modified 2 hours, 33 minutes ago by midwestE.


This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer