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) {
sg_cachepress_purge_everything();
}
});
- The topic ‘Fatal error after deleting Woo attribute term’ is closed to new replies.