-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathuninstall.php
35 lines (30 loc) · 926 Bytes
/
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
34
35
<?php
/**
* GistPress
*
* @package GistPress
* @author Brady Vercher <[email protected]>
* @author Gary Jones <[email protected]>
* @copyright Copyright (c) 2012, Blazer Six, Inc.
* @license GPL-2.0+
*/
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
exit;
}
global $wpdb;
delete_option( 'blazersix_gist_oembed_stylesheet' );
delete_option( 'gistpress_stylesheet' );
// Delete post meta.
$post_metas = $wpdb->get_results( "SELECT post_id, meta_key FROM $wpdb->postmeta WHERE meta_key LIKE '_gist_raw_%'" );
if ( $post_metas ) {
foreach( $post_metas as $meta ) {
delete_post_meta( $meta->post_id, $meta->meta_key );
}
}
// Delete transients.
$transients = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '_transient_gist_html_%' OR option_name LIKE '_transient__gist_raw_%'" );
if ( $transients ) {
foreach ( $transients as $key ) {
delete_transient( $key );
}
}