-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathuninstall.php
33 lines (27 loc) · 1.03 KB
/
uninstall.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/**
* AweBooking Uninstall.
*
* Deletes user roles, pages, tables, and options.
*
* @package AweBooking
*/
global $wpdb;
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
if ( defined( 'AWEBOOKING_REMOVE_ALL_DATA' ) && true === AWEBOOKING_REMOVE_ALL_DATA ) {
// Tables.
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_rooms" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_booking" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_pricing" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_availability" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_booking_items" );
$wpdb->query( "DROP TABLE IF EXISTS {$wpdb->prefix}awebooking_booking_itemmeta" );
// Delete options.
$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name LIKE 'awebooking\_%';" );
// Delete posts + data.
$wpdb->query( "DELETE FROM {$wpdb->posts} WHERE post_type IN ( 'room_type', 'awebooking' );" );
// Clear any cached data that has been removed.
wp_cache_flush();
}