WooCommerce deactivate randomly
-
Hello,
We are having a strange issue with WooCommerce which is deactivate randomly. We don’t know why, we don’t receive any error, nothing.
We are using this code to try to debug but we receive notification every time we access plugins page.
Maybe it’s our code wrong, I don’t know but we are facing with this issue from 1 year almost, and the plugin deactivate it’s randomly, maybe 1 time per month. Lately it’s almost 2-3 times per week.
We have tried to deactivate plugin one by one, but the issue persists, also, tried with storefront, same issue. We really don’t know what to do anymore.
Also, if we put this code on a fresh WordPress installation we receive the notification.
Do you have any ideas regarding this?
Waiting for your reply,
Thank you!function prevent_woocommerce_deactivation($actions, $plugin_file, $plugin_data, $context) { // Path to the WooCommerce main file. $plugin = 'woocommerce/woocommerce.php'; // Check if the plugin is WooCommerce. if ($plugin_file == $plugin) { // Remove the Deactivate link. if (array_key_exists('deactivate', $actions)) { unset($actions['deactivate']); // Get current user. $current_user = wp_get_current_user(); // Get request details. $ip_address = $_SERVER['REMOTE_ADDR']; $user_agent = $_SERVER['HTTP_USER_AGENT']; $request_url = $_SERVER['REQUEST_URI']; // Log the details. error_log("Attempted WooCommerce deactivation at " . date( 'Y-m-d H:i:s' )); error_log("Attempted by: " . $current_user->user_login . " (email: " . $current_user->user_email . ")"); error_log("IP Address: " . $ip_address); error_log("User Agent: " . $user_agent); error_log("Request URL: " . $request_url); // Send an email. $to = 'emailaddress'; $subject = 'Attempted WooCommerce Deactivation'; $message = 'An attempt was made to deactivate WooCommerce at ' . date( 'Y-m-d H:i:s' ); $message .= "\n\nAttempted by: " . $current_user->user_login . " (email: " . $current_user->user_email . ")"; $message .= "\n\nIP Address: " . $ip_address; $message .= "\nUser Agent: " . $user_agent; $message .= "\nRequest URL: " . $request_url; wp_mail( $to, $subject, $message ); } } return $actions; } add_filter('plugin_action_links', 'prevent_woocommerce_deactivation', 10, 4);
The topic ‘WooCommerce deactivate randomly’ is closed to new replies.