Unable to remove action hook in WooCommerce plugin
-
I wrote a plugin that performs some logic before displaying product image thumbnails. It worked previously, but the client has now switched themes and for some reason the plugin no longer works.
What I am seeing is that a remove_action is no longer removing the action… Here is an excerpt of the code:
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 0); add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10); /** * WooCommerce Loop Product Thumbs **/ if ( ! function_exists( 'woocommerce_template_loop_product_thumbnail' ) ) { function woocommerce_template_loop_product_thumbnail() { echo woocommerce_get_product_thumbnail(); } } else { echo 'EXISTS'; }
EXISTS is being echoed to the page which tells me that the “woocommerce_template_loop_product_thumbnail” hook was not removed.
I am not a well-seasoned plugin developer, although the above code worked flawlessly for over a year. Can anyone tell me why the remove_action(…) is not working – how I might be able to debug it – or what I might be able to try alternatively? Every search result I’ve found gives an example code snippet almost verbatim of what I pasted above. :S
Thank you.
- The topic ‘Unable to remove action hook in WooCommerce plugin’ is closed to new replies.