# sellkit/1.2.9/uninstall.php

SellKit – Funnel builder and checkout optimizer for WooCommerce to sell more, faster, version 1.2.9. 52 lines.

- Page: https://pluginprobe.com/plugins/sellkit/1.2.9/code/uninstall.php
- Raw: https://pluginprobe.com/plugins/sellkit/1.2.9/raw/uninstall.php
- Modified: 2022-09-08T06:36:34+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sellkit/1.2.9/code/uninstall.php#L10-L20`.

```php
<?php
/**
 * Sellkit Uninstall
 *
 * Uninstalling Sellkit deletes tables, and options.
 *
 * @package Sellkit\Uninstaller
 * @version NEXT
 */

defined( 'WP_UNINSTALL_PLUGIN' ) || exit;

// Include file of Database Class.
require_once dirname( __FILE__ ) . '/includes/db.php';

$options = get_option( 'sellkit', [] );

if ( '1' === $options['delete_data'] ) {
	// Drop Sellkit admin tables.
	Sellkit\Database::drop_all_tables();

	// Delete sellkit option from wp_options.
	delete_option( 'sellkit' );

	// Delete alls sellkit posts with their related meta fields.
	global $wpdb;

	$posts_id  = $wpdb->prefix . 'posts.id';
	$meta_id   = $wpdb->prefix . 'postmeta.post_id';
	$posts     = $wpdb->prefix . 'posts'; // phpcs:ignore
	$meta      = $wpdb->prefix . 'postmeta';
	$post_type = $wpdb->prefix . 'posts.post_type'; //phpcs:ignore

	// phpcs:disable
	$wpdb->query(
		"DELETE $posts, $meta
		FROM $posts
		INNER JOIN $meta ON $meta_id = $posts_id
		WHERE $post_type IN ( 'sellkit-funnels', 'sellkit_step' )"
	);
	// phpcs:enable

	// Unset sellkit cookie.
	setcookie( 'sellkit_contact_segmentation', null, -1, '/' );

	// Clear any cached data that has been removed.
	wp_cache_flush();

	// Temporary option.
	update_option( 'sellkit_pro_delete_data', '1' );
}

```
