summaryrefslogtreecommitdiffstats
path: root/uninstall.php
diff options
context:
space:
mode:
authorMurilo Ijanc <[email protected]>2026-07-26 16:41:48 -0300
committerMurilo Ijanc <[email protected]>2026-07-26 16:47:14 -0300
commit535dbda6b48171f8115b455e54790de94d97d42a (patch)
tree5c0410011e61a883bdf063ee612875a637fb1d22 /uninstall.php
downloadwoocommerce-0.1.0.tar.gz
Initial importv0.1.0
Diffstat (limited to 'uninstall.php')
-rw-r--r--uninstall.php41
1 files changed, 41 insertions, 0 deletions
diff --git a/uninstall.php b/uninstall.php
new file mode 100644
index 0000000..a3c0333
--- /dev/null
+++ b/uninstall.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * Remove every trace of the plugin when it is deleted.
+ *
+ * Runs on delete, not on deactivate: a store owner switching the plugin off to
+ * debug something should not lose their settings.
+ *
+ * @package CepisWooCommerce
+ */
+
+declare(strict_types=1);
+
+defined( 'WP_UNINSTALL_PLUGIN' ) || exit;
+
+$cepis_woo_options = array(
+ 'cepis_woo_enabled',
+ 'cepis_woo_mode',
+ 'cepis_woo_overwrite',
+ 'cepis_woo_focus_number',
+ 'cepis_woo_base_url',
+);
+
+foreach ( $cepis_woo_options as $cepis_woo_option ) {
+ delete_option( $cepis_woo_option );
+}
+
+global $wpdb;
+
+$cepis_woo_names = $wpdb->get_col(
+ $wpdb->prepare(
+ "SELECT option_name FROM {$wpdb->options} WHERE option_name LIKE %s OR option_name LIKE %s",
+ $wpdb->esc_like( '_transient_cepis_woo_' ) . '%',
+ $wpdb->esc_like( '_transient_timeout_cepis_woo_' ) . '%'
+ )
+);
+
+foreach ( (array) $cepis_woo_names as $cepis_woo_name ) {
+ delete_option( (string) $cepis_woo_name );
+}
+
+wp_cache_flush();