| 1 |
<?php |
| 2 |
/** |
| 3 |
* Uninstall Woo Additional Terms. |
| 4 |
* Fired when the plugin is uninstalled. |
| 5 |
* |
| 6 |
* @since 1.0.0 |
| 7 |
* |
| 8 |
* @package woo-additional-terms |
| 9 |
*/ |
| 10 |
|
| 11 |
defined( 'ABSPATH' ) || exit; // Exit if accessed directly. |
| 12 |
defined( 'WP_UNINSTALL_PLUGIN' ) || exit; // If uninstall not called from WordPress, then exit. |
| 13 |
|
| 14 |
// Delete the onboarding (welcome) notice preference. |
| 15 |
delete_site_option( 'woo_additional_terms_onboarding' ); |
| 16 |
|
| 17 |
// Delete the already rated preference. |
| 18 |
delete_option( 'woo_additional_terms_rated' ); |
| 19 |
|
| 20 |
// Reset the activation timestamp as the user already decided to delete the plugin. |
| 21 |
delete_site_option( 'woo_additional_terms_activation_timestamp' ); |
| 22 |
|
| 23 |
/* |
| 24 |
* Only perform uninstall if WC_REMOVE_ALL_DATA constant is set to true in user's |
| 25 |
* wp-config.php. This is to prevent data loss when deleting the plugin from the backend |
| 26 |
* and to ensure only the site owner can perform this action. |
| 27 |
*/ |
| 28 |
if ( defined( 'WC_REMOVE_ALL_DATA' ) && true === WC_REMOVE_ALL_DATA ) { |
| 29 |
delete_option( 'woo_additional_terms_options' ); |
| 30 |
// For site options in Multisite. |
| 31 |
delete_site_option( 'woo_additional_terms_options' ); |
| 32 |
} |
| 33 |
|