yith-woocommerce-wishlist
Last commit date
assets
7 years ago
includes
7 years ago
languages
7 years ago
plugin-fw
7 years ago
plugin-options
7 years ago
templates
7 years ago
README.txt
7 years ago
init.php
7 years ago
screenshot-1.png
7 years ago
screenshot-2.png
7 years ago
screenshot-3.png
7 years ago
screenshot-4.png
7 years ago
uninstall.php
7 years ago
wpml-config.xml
7 years ago
uninstall.php
53 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Uninstall plugin |
| 4 | * |
| 5 | * @author Your Inspiration Themes |
| 6 | * @package YITH WooCommerce Wishlist |
| 7 | * @version 2.0.16 |
| 8 | */ |
| 9 | |
| 10 | // If uninstall not called from WordPress exit |
| 11 | if( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { |
| 12 | exit; |
| 13 | } |
| 14 | |
| 15 | function yith_wcwl_uninstall(){ |
| 16 | global $wpdb; |
| 17 | |
| 18 | // define local private attribute |
| 19 | $wpdb->yith_wcwl_items = $wpdb->prefix . 'yith_wcwl'; |
| 20 | $wpdb->yith_wcwl_wishlists = $wpdb->prefix . 'yith_wcwl_lists'; |
| 21 | |
| 22 | // Delete option from options table |
| 23 | delete_option( 'yith_wcwl_version' ); |
| 24 | delete_option( 'yith_wcwl_db_version' ); |
| 25 | $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->options} WHERE option_name LIKE %s", 'yith_wcwl_%' ) ); |
| 26 | |
| 27 | //delete pages created for this plugin |
| 28 | wp_delete_post( get_option( 'yith-wcwl-pageid' ), true ); |
| 29 | |
| 30 | //remove any additional options and custom table |
| 31 | $sql = "DROP TABLE IF EXISTS `" . $wpdb->yith_wcwl_items . "`"; |
| 32 | $wpdb->query( $sql ); |
| 33 | $sql = "DROP TABLE IF EXISTS `" . $wpdb->yith_wcwl_wishlists . "`"; |
| 34 | $wpdb->query( $sql ); |
| 35 | } |
| 36 | |
| 37 | |
| 38 | |
| 39 | if ( ! is_multisite() ) { |
| 40 | yith_wcwl_uninstall(); |
| 41 | } |
| 42 | else { |
| 43 | global $wpdb; |
| 44 | $blog_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ); |
| 45 | $original_blog_id = get_current_blog_id(); |
| 46 | |
| 47 | foreach ( $blog_ids as $blog_id ) { |
| 48 | switch_to_blog( $blog_id ); |
| 49 | yith_wcwl_uninstall(); |
| 50 | } |
| 51 | |
| 52 | switch_to_blog( $original_blog_id ); |
| 53 | } |