-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathuninstall.php
70 lines (28 loc) · 976 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
/**
* @package wp-bitly
* @author Mark Waterous <mark@watero.us>
* @license GPL-2.0+
* @link http://wordpress.org/plugins/wp-bitly
* @copyright 2014 Mark Waterous
*/
if (!defined('WP_UNINSTALL_PLUGIN'))
die;
/**
* Some people just don't know how cool this plugin is. When they realize
* it and come back later, let's make sure they have to start all over.
*
* @return void
*/
function wpbitly_uninstall() {
// Delete associated options
delete_option('wpbitly-options');
// Grab all posts with an attached shortlink
$posts = get_posts('numberposts=-1&post_type=any&meta_key=_wpbitly');
// And remove our meta information from them
// @TODO benchmark this against deleting it with a quick SQL query. Probably quicker, any conflict?
foreach ($posts as $post)
delete_post_meta($post->ID, '_wpbitly');
}
// G'bye!
wpbitly_uninstall();