-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathuninstall.php
More file actions
37 lines (30 loc) · 901 Bytes
/
uninstall.php
File metadata and controls
37 lines (30 loc) · 901 Bytes
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
36
37
<?php
/**
* Our uninstall call.
*
* @package FAIR
*/
// Only run this on the actual WP uninstall function.
if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) {
die;
}
// Include the avatar namespace so we can use the constant.
require_once __DIR__ . '/inc/avatars/namespace.php';
// Delete any single or multisite keys.
delete_option( 'fair_indexnow_key' );
delete_site_option( \FAIR\Avatars\AVATAR_SRC_SETTING_KEY );
// Delete any transients we may have created or modified.
delete_site_transient( 'update_plugins' );
delete_site_transient( 'update_themes' );
global $wpdb;
// Prepare our delete query.
$query_args = $wpdb->prepare("
DELETE FROM $wpdb->usermeta
WHERE meta_key IN (
%s,
%s
)
", 'fair_avatar_site_id', 'fair_avatar_id' );
// And actually run it.
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- we did use the prepare function above
$wpdb->query( $query_args );